summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Fix `mock.patch.dict` to be stopped with `mock.patch.stopall` (#17606)Mario Corchero2020-01-243-2/+69
| | | | | 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.
* bpo-24928: Add test case for patch.dict using OrderedDict (GH -11437)Emmanuel Arias2020-01-241-0/+20
| | | | | * add test for path.dict using OrderedDict Co-authored-by: Yu Tomita nekobon@users.noreply.github.com
* bpo-17005: Minor improvements to the documentation of TopologicalSorter ↵Pablo Galindo2020-01-231-75/+67
| | | | (GH-18155)
* bpo-39431: Also mention nonlocal in assignment quirk (GH-17375)Shanavas M2020-01-231-4/+4
|
* bpo-17005: Add a class to perform topological sorting to the standard ↵Pablo Galindo2020-01-236-3/+738
| | | | | library (GH-11583) Co-Authored-By: Tim Peters <tim.peters@gmail.com>
* bpo-39421: Fix posible crash in heapq with custom comparison operators ↵Pablo Galindo2020-01-233-9/+59
| | | | | | | | | | (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
* bpo-39320: Handle unpacking of *values in compiler (GH-17984)Mark Shannon2020-01-2310-2347/+2336
| | | | | | | | * 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.
* bpo-32989: IDLE - remove unneeded parameter (GH-18138)Terry Jan Reedy2020-01-232-2/+3
| | | | | IDLE does not pass a non-default _synchre in any of its calls to pyparse.find_good_parse_start.
* bpo-39050: The Help button in IDLE's config menu works again (GH-17611)Zackery Spytz2020-01-234-1/+15
| | | | Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-29435: Allow is_tarfile to take a filelike obj (GH-18090)William Woodruff2020-01-235-2/+45
| | | `is_tarfile()` now supports `name` being a file or file-like object.
* bpo-39427: Document -X opt options in the CLI --help and the man page (GH-18131)Pablo Galindo2020-01-233-2/+73
| | | | | | | https://bugs.python.org/issue39427 Automerge-Triggered-By: @pablogsal
* bpo-39336: Allow packages to not let their child modules be set on them (#18006)Dino Viehland2020-01-236-338/+379
| | | | | * 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.
* bpo-35182: fix communicate() crash after child closes its pipes (GH-17020) ↵Alex Rebert2020-01-223-2/+16
| | | | | | | | | (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>
* bpo-39366: Remove xpath() and xgtitle() methods of NNTP (GH-18035)Dong-hee Na2020-01-224-66/+9
|
* bpo-39406: Implement os.putenv() with setenv() if available (GH-18128)Victor Stinner2020-01-226-38/+35
| | | | | 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.
* bpo-39406: os.putenv() avoids putenv_dict on Windows (GH-18126)Victor Stinner2020-01-221-2/+6
| | | | Windows: _wputenv(env) copies the *env* string and doesn't require the caller to manage the variable memory.
* Revert "bpo-39413: Implement os.unsetenv() on Windows (GH-18104)" (GH-18124)Victor Stinner2020-01-226-94/+12
| | | This reverts commit 56cd3710a1ea3ba872d345ea1bebc86ed08bc8b8.
* bpo-39353: Deprecate the binhex module (GH-18025)Victor Stinner2020-01-229-25/+120
| | | | | | | | Deprecate binhex4 and hexbin4 standards. Deprecate the binhex module and the following binascii functions: * b2a_hqx(), a2b_hqx() * rlecode_hqx(), rledecode_hqx() * crc_hqx()
* bpo-39425: Fix list.count performance regression (GH-18119)Dong-hee Na2020-01-221-0/+4
| | | | | | | https://bugs.python.org/issue39425 Automerge-Triggered-By: @pablogsal
* bpo-39377: json: Update doc about the encoding option. (GH-18076)Inada Naoki2020-01-222-8/+11
| | | | Co-authored-by: Kyle Stanley <aeros167@gmail.com>
* closes bpo-39415: Remove unused codes from longobject.c complexobject.c ↵Dong-hee Na2020-01-223-68/+0
| | | | floatobject.c. (GH-18105)
* PyLong_AsLongLong() docs should say 'long long' (#18082)Keith Erskine2020-01-211-1/+1
|
* bpo-39406: Add PY_PUTENV_DICT macro to posixmodule.c (GH-18106)Victor Stinner2020-01-211-15/+37
| | | Rename posix_putenv_garbage to putenv_dict.
* bpo-39413: Implement os.unsetenv() on Windows (GH-18104)Victor Stinner2020-01-216-12/+92
| | | | | The os.unsetenv() function is now also available on Windows. It is implemented with SetEnvironmentVariableW(name, NULL).
* Move test_math tests (GH-18098)Victor Stinner2020-01-211-148/+148
| | | | | testPerm() and testComb() belong to MathTests, not to IsCloseTests(). test_nextafter() and test_ulp() now use assertIsNaN().
* bpo-33387: Fix compiler warning in frame_block_unwind() (GH-18099)Victor Stinner2020-01-211-1/+1
| | | | | | 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
* bpo-39389: gzip: fix compression level metadata (GH-18077)William Chargin2020-01-213-3/+31
| | | | | | 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.
* bpo-39396: Fix math.nextafter(-0.0, +0.0) on AIX 7.1 (GH-18094)Victor Stinner2020-01-213-79/+86
| | | | Move also math.nextafter() on math.ulp() tests from IsCloseTests to MathTests.
* bpo-32989: IDLE - fix bad editor call of pyparse method (GH-5968)Cheryl Sabella2020-01-216-39/+154
| | | | | | | | 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>
* improve the documentation of the LOAD_METHOD and CALL_METHOD (GH-18079)Carl Friedrich Bolz-Tereick2020-01-211-8/+10
|
* bpo-39383: Mention Darwin as a potential value for platform.system() (GH-18054)Peter Bittner2020-01-201-3/+2
|
* bpo-39386: Prevent double awaiting of async iterator (GH-18081)Andrew Svetlov2020-01-203-4/+49
|
* Fix asyncio.get_event_loop() documentation (GH-18051)Andrew Svetlov2020-01-202-2/+6
| | | Mention that the function implicitly creates new event loop only if called from the main thread.
* bpo-35134: Migrate frameobject.h contents to cpython/frameobject.h (GH-18052)Nick Coghlan2020-01-202-74/+95
|
* bpo-39377: json: Remove the encoding option. (GH-18075)Inada Naoki2020-01-203-15/+2
|
* bpo-38536: locale: Remove trailing space in formatted currency (GH-16864)Inada Naoki2020-01-203-2/+5
|
* bpo-35561: Supress valgrind false alarm on epoll_ctl(event) (GH-18060)Zackery Spytz2020-01-191-0/+8
| | | Update Misc/valgrind-python.supp to suppress the false alarm.
* Fix typo from base to based (GH-18055)Michael Haas2020-01-191-1/+1
|
* bpo-39372: Clean header files of declared interfaces with no implementations ↵Pablo Galindo2020-01-1817-67/+8
| | | | | | | | (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.
* Run doctests in GitHub actions Docs targer (GH-18041)Pablo Galindo2020-01-171-9/+9
|
* Fix Lock.locked() to remove extra bold highlighting (#18042)Grant Jenks2020-01-171-0/+1
|
* bpo-39356, zipfile: Remove code handling DeprecationWarning (GH-18027)Victor Stinner2020-01-171-19/+9
| | | | | | | | 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.
* bpo-39357: Update bz2 docstring: remove buffering (GH-18036)Victor Stinner2020-01-171-2/+0
| | | Thanks Karthikeyan Singaravelan for the report ;-)
* bpo-39357: Remove buffering parameter of bz2.BZ2File (GH-18028)Victor Stinner2020-01-165-15/+26
| | | | | | | 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.
* bpo-31031: Unify duplicate bits_in_digit and bit_length (GH-2866)Niklas Fiekas2020-01-164-54/+35
| | | Add _Py_bit_length() to unify duplicate bits_in_digit() and bit_length().
* bpo-39350: Remove deprecated fractions.gcd() (GH-18021)Victor Stinner2020-01-165-60/+9
| | | | Remove fractions.gcd() function, deprecated since Python 3.5 (bpo-22486): use math.gcd() instead.
* bpo-39351: Remove base64.encodestring() (GH-18022)Victor Stinner2020-01-165-36/+8
| | | | | Remove base64.encodestring() and base64.decodestring(), aliases deprecated since Python 3.1: use base64.encodebytes() and base64.decodebytes() instead.
* bpo-39348: Fix code highlight for the SOCK_NONBLOCK example (GH-18018)Oz N Tiram2020-01-151-1/+3
| | | | | | | | | | | 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
* bpo-37958: Adding get_profile_dict to pstats (GH-15495)Daniel Olshansky2020-01-154-4/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Fix typo in multiprocessing.pool.AsyncResult.successful doc. (GH-17932)Antoine2020-01-151-1/+1
| | | | | | | | 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.