d3a1de2 | Victor Stinner | 27 January 2020, 22:23:12 UTC | bpo-38631: Avoid Py_FatalError() in _PyCodecRegistry_Init() (GH-18217) _PyCodecRegistry_Init() now reports exceptions to the caller, rather than calling Py_FatalError(). | 27 January 2020, 22:23:12 UTC |
dd023ad | Cheryl Sabella | 27 January 2020, 22:15:56 UTC | bpo-30780: Add IDLE configdialog tests (#3592) Expose dialog buttons to test code and complete their test coverage. Complete test coverage for highlights and keys tabs. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> | 27 January 2020, 22:15:56 UTC |
2528a6c | Dino Viehland | 27 January 2020, 22:04:56 UTC | Add test.test_import.data.unwritable package to makefile (#18211) | 27 January 2020, 22:04:56 UTC |
47ee8a6 | Victor Stinner | 27 January 2020, 21:37:44 UTC | bpo-38631: Avoid Py_FatalError() in _memory_release() (GH-18214) If the export count is negative, _memory_release() now raises a SystemError and returns -1, rather than calling Py_FatalError() which aborts the process. | 27 January 2020, 21:37:44 UTC |
a94c6b6 | Victor Stinner | 27 January 2020, 21:37:05 UTC | bpo-38631: Avoid Py_FatalError() in PyModule_Create2() (GH-18212) If PyModule_Create2() is called when the Python import machinery is not initialized, it now raises a SystemError and returns NULL, instead of calling Py_FatalError() which aborts the process. The caller must be prepared to handle NULL anyway. | 27 January 2020, 21:37:05 UTC |
4a46adc | Victor Stinner | 27 January 2020, 17:06:42 UTC | bpo-39459: test.pythoninfo logs effective uid/gid (GH-18203) Fix also umask formatting: use octal prefix. | 27 January 2020, 17:06:42 UTC |
9e1ed51 | Dong-hee Na | 27 January 2020, 17:04:25 UTC | bpo-39453: Add testcase for bpo-39453 (GH-18202) https://bugs.python.org/issue39453 Automerge-Triggered-By: @pablogsal Automerge-Triggered-By: @pablogsal | 27 January 2020, 17:04:25 UTC |
7023288 | Nick Coghlan | 27 January 2020, 16:05:03 UTC | Ignore NEWS snippets in code coverage stats (GH-18194) | 27 January 2020, 16:05:03 UTC |
4dbf2d8 | Dong-hee Na | 27 January 2020, 15:02:23 UTC | bpo-39453: Make list.__contains__ hold strong references to avoid crashes (GH-18181) | 27 January 2020, 15:02:23 UTC |
a46575a | Chris Withers | 27 January 2020, 14:55:56 UTC | Clarify and fix assertions that mocks have not been awaited (GH-18196) - The gc.collect is needed for other implementations, such as pypy - Using context managers over multiple lines will only catch the warning from the first line in the context! - remove a skip for a test that no longer fails on pypy | 27 January 2020, 14:55:56 UTC |
c7dd3c7 | Chris Withers | 27 January 2020, 14:11:19 UTC | Use relative imports in mock and its tests to help backporting (GH-18197) * asyncio.run only available in 3.8+ * iscoroutinefunction has important bungfixes in 3.8 * IsolatedAsyncioTestCase only available in 3.8+ | 27 January 2020, 14:11:19 UTC |
997443c | Toshio Kuratomi | 27 January 2020, 12:08:39 UTC | Fix so that test.test_distutils can be executed by unittest and not just regrtest (GH-13480) | 27 January 2020, 12:08:39 UTC |
8a4cd70 | Mark Shannon | 27 January 2020, 09:57:45 UTC | bpo-39320: Handle unpacking of **values in compiler (GH-18141) * Add DICT_UPDATE and DICT_MERGE bytecodes. Use them for ** unpacking. * Remove BUILD_MAP_UNPACK and BUILD_MAP_UNPACK_WITH_CALL, as they are now unused. * Update magic number for ** unpacking opcodes. * Update dis.rst to incorporate new bytecodes. * Add blurb entry. | 27 January 2020, 09:57:45 UTC |
72b1004 | Karthikeyan Singaravelan | 27 January 2020, 06:48:15 UTC | bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock (#16029) | 27 January 2020, 06:48:15 UTC |
10355ed | Raymond Hettinger | 26 January 2020, 04:21:17 UTC | bpo-36018: Add another example for NormalDist() (#18191) | 26 January 2020, 04:21:17 UTC |
4515a59 | 加和 | 26 January 2020, 02:07:40 UTC | Fix linecache.py add lazycache to __all__ and use dict.clear to clear the cache (GH-4641) | 26 January 2020, 02:07:40 UTC |
8271441 | Juhana Jauhiainen | 25 January 2020, 22:18:58 UTC | bpo-39374: Updated sorting documentation (GH-18177) | 25 January 2020, 22:18:58 UTC |
4b09dc7 | Windson yang | 25 January 2020, 19:23:00 UTC | bpo-36654: Add examples for using tokenize module programmically (#12947) | 25 January 2020, 19:23:00 UTC |
7de6174 | alclarks | 25 January 2020, 18:49:58 UTC | bpo-15243: Document __prepare__ as classmethod (GH-17124) | 25 January 2020, 18:49:58 UTC |
aef7dc8 | Vegard Stikbakke | 25 January 2020, 15:44:46 UTC | bpo-38932: Mock fully resets child objects on reset_mock(). (GH-17409) | 25 January 2020, 15:44:46 UTC |
9bfb4a7 | fireattack | 25 January 2020, 15:08:13 UTC | Update 3.8.rst (GH-18173) Fixed the name of the contributor (@selik). | 25 January 2020, 15:08:13 UTC |
d23b08f | Łukasz Langa | 25 January 2020, 13:52:44 UTC | Post 3.9.0a3 | 25 January 2020, 13:52:44 UTC |
b07ead3 | Łukasz Langa | 25 January 2020, 13:52:06 UTC | Merge tag 'v3.9.0a3' Python 3.9.0a3 | 25 January 2020, 13:52:06 UTC |
40c0809 | Paulo Henrique Silva | 25 January 2020, 10:53:54 UTC | bpo-37955: correct mock.patch docs with respect to the returned type (GH-15521) | 25 January 2020, 10:53:54 UTC |
62865f4 | Matthew Kokotovich | 25 January 2020, 10:17:47 UTC | bpo-39082: Allow AsyncMock to correctly patch static/class methods (GH-18116) | 25 January 2020, 10:17:47 UTC |
d0d9fa8 | Cheryl Sabella | 25 January 2020, 09:00:54 UTC | bpo-39388: IDLE: Fix bug when cancelling out of configdialog (GH-18068) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> | 25 January 2020, 09:00:54 UTC |
c33378d | Łukasz Langa | 24 January 2020, 21:05:07 UTC | Python 3.9.0a3 | 24 January 2020, 21:05:07 UTC |
9017e0b | Serhiy Storchaka | 24 January 2020, 17:55:52 UTC | bpo-39430: Fix race condition in lazy imports in tarfile. (GH-18161) Use `from ... import ...` to ensure module is fully loaded before accessing its attributes. | 24 January 2020, 17:55:52 UTC |
656c45e | Victor Stinner | 24 January 2020, 17:05:24 UTC | bpo-38631: Avoid Py_FatalError() in GC collect() (GH-18164) collect() should not get an exception, but it does, logging the exception is enough. Override sys.unraisablehook to decide how to handle unraisable exceptions. Py_FatalError() should be avoided whenever possible. | 24 January 2020, 17:05:24 UTC |
8870433 | mbarkhau | 24 January 2020, 14:51:16 UTC | bpo-39390 shutil: fix argument types for ignore callback (GH-18122) | 24 January 2020, 14:51:16 UTC |
66b00a9 | Karthikeyan Singaravelan | 24 January 2020, 13:14:29 UTC | bpo-38473: Handle autospecced functions and methods used with attach_mock (GH-16784) | 24 January 2020, 13:14:29 UTC |
b8d1262 | Victor Stinner | 24 January 2020, 13:05:48 UTC | bpo-39395: putenv() and unsetenv() always available (GH-18135) The os.putenv() and os.unsetenv() functions are now always available. On non-Windows platforms, Python now requires setenv() and unsetenv() functions to build. Remove putenv_dict from posixmodule.c: it's not longer needed. | 24 January 2020, 13:05:48 UTC |
161e7b3 | Victor Stinner | 24 January 2020, 10:53:44 UTC | bpo-39413: Implement os.unsetenv() on Windows (GH-18163) The os.unsetenv() function is now also available on Windows. | 24 January 2020, 10:53:44 UTC |
2d50976 | Ammar Askar | 24 January 2020, 10:35:01 UTC | bpo-39361: Document the removal of PyTypeObject.tp_print (GH-18125) | 24 January 2020, 10:35:01 UTC |
e9652e8 | Mark Dickinson | 24 January 2020, 10:03:22 UTC | bpo-39426: Fix outdated default and highest protocols in docs (GH-18154) Some portions of the pickle documentation hadn't been updated for the pickle protocol changes in Python 3.8 (new protocol 5, default protocol 4). This PR fixes those docs. https://bugs.python.org/issue39426 | 24 January 2020, 10:03:22 UTC |
b9783d2 | Victor Stinner | 24 January 2020, 09:22:18 UTC | bpo-39429: Add a new "Python Development Mode" doc page (GH-18132) | 24 January 2020, 09:22:18 UTC |
e131c97 | Mario Corchero | 24 January 2020, 08:38:33 UTC | Fix `mock.patch.dict` to be stopped with `mock.patch.stopall` (#17606) As the function was not registering in the active patches, the mocks started by `mock.patch.dict` were not being stopped when `mock.patch.stopall` was being called. | 24 January 2020, 08:38:32 UTC |
1d0c5e1 | Emmanuel Arias | 24 January 2020, 08:14:14 UTC | bpo-24928: Add test case for patch.dict using OrderedDict (GH -11437) * add test for path.dict using OrderedDict Co-authored-by: Yu Tomita nekobon@users.noreply.github.com | 24 January 2020, 08:14:14 UTC |
65ecc39 | Pablo Galindo | 23 January 2020, 21:01:50 UTC | bpo-17005: Minor improvements to the documentation of TopologicalSorter (GH-18155) | 23 January 2020, 21:01:50 UTC |
7142df5 | Shanavas M | 23 January 2020, 18:09:21 UTC | bpo-39431: Also mention nonlocal in assignment quirk (GH-17375) | 23 January 2020, 18:09:21 UTC |
99e6c26 | Pablo Galindo | 23 January 2020, 15:29:52 UTC | bpo-17005: Add a class to perform topological sorting to the standard library (GH-11583) Co-Authored-By: Tim Peters <tim.peters@gmail.com> | 23 January 2020, 15:29:52 UTC |
79f89e6 | Pablo Galindo | 23 January 2020, 14:07:05 UTC | bpo-39421: Fix posible crash in heapq with custom comparison operators (GH-18118) * bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators * fixup! fixup! bpo-39421: Fix posible crash in heapq with custom comparison operators | 23 January 2020, 14:07:05 UTC |
13bc139 | Mark Shannon | 23 January 2020, 09:25:17 UTC | bpo-39320: Handle unpacking of *values in compiler (GH-17984) * Add three new bytecodes: LIST_TO_TUPLE, LIST_EXTEND, SET_UPDATE. Use them to implement star unpacking expressions. * Remove four bytecodes BUILD_LIST_UNPACK, BUILD_TUPLE_UNPACK, BUILD_SET_UNPACK and BUILD_TUPLE_UNPACK_WITH_CALL opcodes as they are now unused. * Update magic number and dis.rst for new bytecodes. | 23 January 2020, 09:25:17 UTC |
f9e07e1 | Terry Jan Reedy | 23 January 2020, 04:55:07 UTC | bpo-32989: IDLE - remove unneeded parameter (GH-18138) IDLE does not pass a non-default _synchre in any of its calls to pyparse.find_good_parse_start. | 23 January 2020, 04:55:07 UTC |
2e43b64 | Zackery Spytz | 23 January 2020, 03:54:30 UTC | bpo-39050: The Help button in IDLE's config menu works again (GH-17611) Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> | 23 January 2020, 03:54:30 UTC |
dd754ca | William Woodruff | 23 January 2020, 02:24:16 UTC | bpo-29435: Allow is_tarfile to take a filelike obj (GH-18090) `is_tarfile()` now supports `name` being a file or file-like object. | 23 January 2020, 02:24:16 UTC |
41f0ef6 | Pablo Galindo | 23 January 2020, 01:03:04 UTC | bpo-39427: Document -X opt options in the CLI --help and the man page (GH-18131) https://bugs.python.org/issue39427 Automerge-Triggered-By: @pablogsal | 23 January 2020, 01:03:04 UTC |
9b6fec4 | Dino Viehland | 23 January 2020, 00:42:38 UTC | bpo-39336: Allow packages to not let their child modules be set on them (#18006) * bpo-39336: Allow setattr to fail on modules which aren't assignable When attaching a child module to a package if the object in sys.modules raises an AttributeError (e.g. because it is immutable) it causes the whole import to fail. This now allows immutable packages to exist and an ImportWarning is reported and the AttributeError exception is ignored. | 23 January 2020, 00:42:38 UTC |
d3ae95e | Alex Rebert | 22 January 2020, 23:28:31 UTC | bpo-35182: fix communicate() crash after child closes its pipes (GH-17020) (GH-18117) When communicate() is called in a loop, it crashes when the child process has already closed any piped standard stream, but still continues to be running Co-authored-by: Andriy Maletsky <andriy.maletsky@gmail.com> | 22 January 2020, 23:28:31 UTC |
1f0f102 | Dong-hee Na | 22 January 2020, 21:59:43 UTC | bpo-39366: Remove xpath() and xgtitle() methods of NNTP (GH-18035) | 22 January 2020, 21:59:43 UTC |
b477d19 | Victor Stinner | 22 January 2020, 21:48:16 UTC | bpo-39406: Implement os.putenv() with setenv() if available (GH-18128) If setenv() C function is available, os.putenv() is now implemented with setenv() instead of putenv(), so Python doesn't have to handle the environment variable memory. | 22 January 2020, 21:48:16 UTC |
0852c7d | Victor Stinner | 22 January 2020, 20:53:26 UTC | bpo-39406: os.putenv() avoids putenv_dict on Windows (GH-18126) Windows: _wputenv(env) copies the *env* string and doesn't require the caller to manage the variable memory. | 22 January 2020, 20:53:26 UTC |
b73dd02 | Victor Stinner | 22 January 2020, 20:11:17 UTC | Revert "bpo-39413: Implement os.unsetenv() on Windows (GH-18104)" (GH-18124) This reverts commit 56cd3710a1ea3ba872d345ea1bebc86ed08bc8b8. | 22 January 2020, 20:11:17 UTC |
beea26b | Victor Stinner | 22 January 2020, 19:44:22 UTC | bpo-39353: Deprecate the binhex module (GH-18025) Deprecate binhex4 and hexbin4 standards. Deprecate the binhex module and the following binascii functions: * b2a_hqx(), a2b_hqx() * rlecode_hqx(), rledecode_hqx() * crc_hqx() | 22 January 2020, 19:44:22 UTC |
14d80d0 | Dong-hee Na | 22 January 2020, 17:36:54 UTC | bpo-39425: Fix list.count performance regression (GH-18119) https://bugs.python.org/issue39425 Automerge-Triggered-By: @pablogsal | 22 January 2020, 17:36:54 UTC |
5bbac8c | Inada Naoki | 22 January 2020, 10:01:24 UTC | bpo-39377: json: Update doc about the encoding option. (GH-18076) Co-authored-by: Kyle Stanley <aeros167@gmail.com> | 22 January 2020, 10:01:24 UTC |
0d5eac8 | Dong-hee Na | 22 January 2020, 02:49:30 UTC | closes bpo-39415: Remove unused codes from longobject.c complexobject.c floatobject.c. (GH-18105) | 22 January 2020, 02:49:30 UTC |
47be7d0 | Keith Erskine | 21 January 2020, 19:14:13 UTC | PyLong_AsLongLong() docs should say 'long long' (#18082) | 21 January 2020, 19:14:13 UTC |
623ed61 | Victor Stinner | 21 January 2020, 18:25:32 UTC | bpo-39406: Add PY_PUTENV_DICT macro to posixmodule.c (GH-18106) Rename posix_putenv_garbage to putenv_dict. | 21 January 2020, 18:25:32 UTC |
56cd371 | Victor Stinner | 21 January 2020, 15:13:09 UTC | bpo-39413: Implement os.unsetenv() on Windows (GH-18104) The os.unsetenv() function is now also available on Windows. It is implemented with SetEnvironmentVariableW(name, NULL). | 21 January 2020, 15:13:09 UTC |
59e2d26 | Victor Stinner | 21 January 2020, 11:48:16 UTC | Move test_math tests (GH-18098) testPerm() and testComb() belong to MathTests, not to IsCloseTests(). test_nextafter() and test_ulp() now use assertIsNaN(). | 21 January 2020, 11:48:16 UTC |
629023c | Victor Stinner | 21 January 2020, 11:47:29 UTC | bpo-33387: Fix compiler warning in frame_block_unwind() (GH-18099) Replace int with intptr_t to fix the warning: objects\frameobject.c(341): warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data | 21 January 2020, 11:47:29 UTC |
eab3b3f | William Chargin | 21 January 2020, 11:25:24 UTC | bpo-39389: gzip: fix compression level metadata (GH-18077) As described in RFC 1952, section 2.3.1, the XFL (eXtra FLags) byte of a gzip member header should indicate whether the DEFLATE algorithm was tuned for speed or compression ratio. Prior to this patch, archives emitted by the `gzip` module always indicated maximum compression. | 21 January 2020, 11:25:24 UTC |
85ead4f | Victor Stinner | 21 January 2020, 10:14:10 UTC | bpo-39396: Fix math.nextafter(-0.0, +0.0) on AIX 7.1 (GH-18094) Move also math.nextafter() on math.ulp() tests from IsCloseTests to MathTests. | 21 January 2020, 10:14:10 UTC |
ec64640 | Cheryl Sabella | 21 January 2020, 10:11:26 UTC | bpo-32989: IDLE - fix bad editor call of pyparse method (GH-5968) Fix comments and add tests for editor newline_and_indent_event method. Remove unused None default for function parameter of pyparse find_good_parse_start method and code triggered by that default. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> | 21 January 2020, 10:11:26 UTC |
8698b34 | Carl Friedrich Bolz-Tereick | 21 January 2020, 00:41:17 UTC | improve the documentation of the LOAD_METHOD and CALL_METHOD (GH-18079) | 21 January 2020, 00:41:16 UTC |
8d57a41 | Peter Bittner | 20 January 2020, 23:22:56 UTC | bpo-39383: Mention Darwin as a potential value for platform.system() (GH-18054) | 20 January 2020, 23:22:56 UTC |
a96e06d | Andrew Svetlov | 20 January 2020, 22:49:30 UTC | bpo-39386: Prevent double awaiting of async iterator (GH-18081) | 20 January 2020, 22:49:30 UTC |
2c49bec | Andrew Svetlov | 20 January 2020, 22:46:38 UTC | Fix asyncio.get_event_loop() documentation (GH-18051) Mention that the function implicitly creates new event loop only if called from the main thread. | 20 January 2020, 22:46:38 UTC |
1e420f8 | Nick Coghlan | 20 January 2020, 22:21:35 UTC | bpo-35134: Migrate frameobject.h contents to cpython/frameobject.h (GH-18052) | 20 January 2020, 22:21:35 UTC |
5492bfc | Inada Naoki | 20 January 2020, 04:54:00 UTC | bpo-39377: json: Remove the encoding option. (GH-18075) | 20 January 2020, 04:54:00 UTC |
e96d954 | Inada Naoki | 20 January 2020, 03:45:50 UTC | bpo-38536: locale: Remove trailing space in formatted currency (GH-16864) | 20 January 2020, 03:45:50 UTC |
d8ef644 | Zackery Spytz | 19 January 2020, 22:38:37 UTC | bpo-35561: Supress valgrind false alarm on epoll_ctl(event) (GH-18060) Update Misc/valgrind-python.supp to suppress the false alarm. | 19 January 2020, 22:38:37 UTC |
558f078 | Michael Haas | 19 January 2020, 10:29:42 UTC | Fix typo from base to based (GH-18055) | 19 January 2020, 10:29:42 UTC |
cd7db76 | Pablo Galindo | 18 January 2020, 03:14:59 UTC | bpo-39372: Clean header files of declared interfaces with no implementations (GH-18037) The public API symbols being removed are: _PyBytes_InsertThousandsGroupingLocale, _PyBytes_InsertThousandsGrouping, _Py_InitializeFromArgs, _Py_InitializeFromWideArgs, _PyFloat_Repr, _PyFloat_Digits, _PyFloat_DigitsInit, PyFrame_ExtendStack, _PyAIterWrapper_Type, PyNullImporter_Type, PyCmpWrapper_Type, PySortWrapper_Type, PyNoArgsFunction. | 18 January 2020, 03:14:59 UTC |
6aabb63 | Pablo Galindo | 17 January 2020, 23:44:38 UTC | Run doctests in GitHub actions Docs targer (GH-18041) | 17 January 2020, 23:44:38 UTC |
ef8844f | Grant Jenks | 17 January 2020, 22:54:44 UTC | Fix Lock.locked() to remove extra bold highlighting (#18042) | 17 January 2020, 22:54:44 UTC |
1d3b0aa | Victor Stinner | 17 January 2020, 14:17:48 UTC | bpo-39356, zipfile: Remove code handling DeprecationWarning (GH-18027) Remove old "except DeprecationWarning:" code path added by commit bf02e3bb21b2d75cba4ce409a14ae64dbc2dd6d2. It's no longer needed. struct.pack() no longer emit DeprecationWarning if getting a float whereas an integer is expected. It now raises an hard error instead. | 17 January 2020, 14:17:48 UTC |
10fd6b2 | Victor Stinner | 17 January 2020, 12:50:39 UTC | bpo-39357: Update bz2 docstring: remove buffering (GH-18036) Thanks Karthikeyan Singaravelan for the report ;-) | 17 January 2020, 12:50:39 UTC |
9baf242 | Victor Stinner | 16 January 2020, 14:33:30 UTC | bpo-39357: Remove buffering parameter of bz2.BZ2File (GH-18028) Remove the buffering parameter of bz2.BZ2File. Since Python 3.0, it was ignored and using it was emitting a DeprecationWarning. Pass an open file object to control how the file is opened. The compresslevel parameter becomes keyword-only. | 16 January 2020, 14:33:30 UTC |
c5b7900 | Niklas Fiekas | 16 January 2020, 14:09:19 UTC | bpo-31031: Unify duplicate bits_in_digit and bit_length (GH-2866) Add _Py_bit_length() to unify duplicate bits_in_digit() and bit_length(). | 16 January 2020, 14:09:19 UTC |
4691a2f | Victor Stinner | 16 January 2020, 10:02:51 UTC | bpo-39350: Remove deprecated fractions.gcd() (GH-18021) Remove fractions.gcd() function, deprecated since Python 3.5 (bpo-22486): use math.gcd() instead. | 16 January 2020, 10:02:51 UTC |
210c19e | Victor Stinner | 16 January 2020, 09:24:16 UTC | bpo-39351: Remove base64.encodestring() (GH-18022) Remove base64.encodestring() and base64.decodestring(), aliases deprecated since Python 3.1: use base64.encodebytes() and base64.decodebytes() instead. | 16 January 2020, 09:24:16 UTC |
fad8b56 | Oz N Tiram | 15 January 2020, 23:55:13 UTC | bpo-39348: Fix code highlight for the SOCK_NONBLOCK example (GH-18018) The previous double colon was wrongly place directly after Therefore. Which produced a block without syntax highlighting. This fixes it by separating the double colon from the text. As a result, sphinx now properly highlights the python code. https://bugs.python.org/issue39348 | 15 January 2020, 23:55:13 UTC |
01602ae | Daniel Olshansky | 15 January 2020, 22:51:54 UTC | bpo-37958: Adding get_profile_dict to pstats (GH-15495) pstats is really useful or profiling and printing the output of the execution of some block of code, but I've found on multiple occasions when I'd like to access this output directly in an easily usable dictionary on which I can further analyze or manipulate. The proposal is to add a function called get_profile_dict inside of pstats that'll automatically return this data the data in an easily accessible dict. The output of the following script: ``` import cProfile, pstats import pprint from pstats import func_std_string, f8 def fib(n): if n == 0: return 0 if n == 1: return 1 return fib(n-1) + fib(n-2) pr = cProfile.Profile() pr.enable() fib(5) pr.create_stats() ps = pstats.Stats(pr).sort_stats('tottime', 'cumtime') def get_profile_dict(self, keys_filter=None): """ Returns a dict where the key is a function name and the value is a dict with the following keys: - ncalls - tottime - percall_tottime - cumtime - percall_cumtime - file_name - line_number keys_filter can be optionally set to limit the key-value pairs in the retrieved dict. """ pstats_dict = {} func_list = self.fcn_list[:] if self.fcn_list else list(self.stats.keys()) if not func_list: return pstats_dict pstats_dict["total_tt"] = float(f8(self.total_tt)) for func in func_list: cc, nc, tt, ct, callers = self.stats[func] file, line, func_name = func ncalls = str(nc) if nc == cc else (str(nc) + '/' + str(cc)) tottime = float(f8(tt)) percall_tottime = -1 if nc == 0 else float(f8(tt/nc)) cumtime = float(f8(ct)) percall_cumtime = -1 if cc == 0 else float(f8(ct/cc)) func_dict = { "ncalls": ncalls, "tottime": tottime, # time spent in this function alone "percall_tottime": percall_tottime, "cumtime": cumtime, # time spent in the function plus all functions that this function called, "percall_cumtime": percall_cumtime, "file_name": file, "line_number": line } func_dict_filtered = func_dict if not keys_filter else { key: func_dict[key] for key in keys_filter } pstats_dict[func_name] = func_dict_filtered return pstats_dict pp = pprint.PrettyPrinter(depth=6) pp.pprint(get_profile_dict(ps)) ``` will produce: ``` {"<method 'disable' of '_lsprof.Profiler' objects>": {'cumtime': 0.0, 'file_name': '~', 'line_number': 0, 'ncalls': '1', 'percall_cumtime': 0.0, 'percall_tottime': 0.0, 'tottime': 0.0}, 'create_stats': {'cumtime': 0.0, 'file_name': '/usr/local/Cellar/python/3.7.4/Frameworks/Python.framework/Versions/3.7/lib/python3.7/cProfile.py', 'line_number': 50, 'ncalls': '1', 'percall_cumtime': 0.0, 'percall_tottime': 0.0, 'tottime': 0.0}, 'fib': {'cumtime': 0.0, 'file_name': 'get_profile_dict.py', 'line_number': 5, 'ncalls': '15/1', 'percall_cumtime': 0.0, 'percall_tottime': 0.0, 'tottime': 0.0}, 'total_tt': 0.0} ``` As an example, this can be used to generate a stacked column chart using various visualization tools which will assist in easily identifying program bottlenecks. https://bugs.python.org/issue37958 Automerge-Triggered-By: @gpshead | 15 January 2020, 22:51:54 UTC |
dc0284e | Antoine | 15 January 2020, 20:12:42 UTC | Fix typo in multiprocessing.pool.AsyncResult.successful doc. (GH-17932) Since 3.7 `successful` raises a `ValueError` as explained in the next text block from the documentation: _Changed in version 3.7: If the result is not ready, ValueError is raised instead of AssertionError._ No issue associated with this PR. Should be backported in 3.7 and 3.8. | 15 January 2020, 20:12:41 UTC |
e92d393 | Ammar Askar | 15 January 2020, 16:48:40 UTC | Fix compiler warning on Windows (GH-18012) Python-ast.h contains a macro named Yield that conflicts with the Yield macro in Windows system headers. While Python-ast.h has an "undef Yield" directive to prevent this, it means that Python-ast.h must be included before Windows header files or we run into a re-declaration warning. In commit c96be811fa7d an include for pycore_pystate.h was added which indirectly includes Windows header files. In this commit we re-order the includes to fix this warning. | 15 January 2020, 16:48:40 UTC |
e85a305 | Victor Stinner | 15 January 2020, 16:38:55 UTC | bpo-38630: Fix subprocess.Popen.send_signal() race condition (GH-16984) On Unix, subprocess.Popen.send_signal() now polls the process status. Polling reduces the risk of sending a signal to the wrong process if the process completed, the Popen.returncode attribute is still None, and the pid has been reassigned (recycled) to a new different process. | 15 January 2020, 16:38:55 UTC |
ed154c3 | Hai Shi | 15 January 2020, 16:32:51 UTC | bpo-1635741: Port _json extension module to multiphase initialization (PEP 489) (GH-17835) | 15 January 2020, 16:32:51 UTC |
3f12ac1 | Victor Stinner | 15 January 2020, 10:23:25 UTC | bpo-39164: Fix compiler warning in PyErr_GetExcInfo() (GH-18010) The function has no return value. | 15 January 2020, 10:23:25 UTC |
cf288b5 | Elena Oat | 15 January 2020, 09:50:57 UTC | Fix AsyncMock base class in the docs (GH-18008) | 15 January 2020, 09:50:57 UTC |
54f743e | Karthikeyan Singaravelan | 15 January 2020, 09:49:49 UTC | Improve test coverage for AsyncMock. (GH-17906) * Add test for nested async decorator patch. * Add test for side_effect and wraps with a function. * Add test for side_effect with an exception in the iterable. | 15 January 2020, 09:49:49 UTC |
45cf5db | Pablo Galindo | 14 January 2020, 22:32:55 UTC | Allow pgen to produce a DOT format dump of the grammar (GH-18005) Originally suggested by Anthony Shaw. | 14 January 2020, 22:32:55 UTC |
65a5ce2 | Dong-hee Na | 14 January 2020, 21:42:09 UTC | bpo-39329: Add timeout parameter for smtplib.LMTP constructor (GH-17998) | 14 January 2020, 21:42:09 UTC |
7d63780 | Vinay Sajip | 14 January 2020, 20:49:30 UTC | bpo-38901: Allow setting a venv's prompt to the basename of the current directory. (GH-17946) When a prompt value of '.' is specified, os.path.basename(os.getcwd()) is used to configure the prompt for the created venv. | 14 January 2020, 20:49:30 UTC |
4b0d91a | Dima | 14 January 2020, 20:47:59 UTC | venv: Suppress warning message when bash hashing is disabled. (GH-17966) When using python's built-in venv activaton script warnings are printed when hashing is disabled in bash or zsh, like; `bash: hash: hashing disabled` This output is not really useful to the end-user and has been disabled in `virtualenv` for long. This commit is based on: https://github.com/pypa/virtualenv/commit/28e85bcd80d04b2a7ebce0e1d0b02d432b7e5593 | 14 January 2020, 20:47:59 UTC |
b4cdb3f | Kyle Pollina | 14 January 2020, 19:47:26 UTC | Fix documentation in code.py (GH-17988) | 14 January 2020, 19:47:25 UTC |
f04750b | Václav Bartoš | 14 January 2020, 17:57:04 UTC | bpo-38361: syslog: fixed making default "ident" from sys.argv[0] (GH-16557) The default value of "ident" parameter should be sys.argv[0] with leading path components stripped, but it contained the last slash, i.e. '/program' instead of 'program'. BPO issue: https://bugs.python.org/issue38361 https://bugs.python.org/issue38361 | 14 January 2020, 17:57:04 UTC |
b679137 | Pablo Galindo | 14 January 2020, 17:38:15 UTC | bpo-39322: Add gc.is_finalized to the gc module docstring (GH-18000) | 14 January 2020, 17:38:15 UTC |
a2ec3f0 | Pablo Galindo | 14 January 2020, 12:06:45 UTC | bpo-39322: Add gc.is_finalized to check if an object has been finalised by the gc (GH-17989) | 14 January 2020, 12:06:45 UTC |