summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* bpo-39627: Fix TypedDict totality check for inherited keys (#18503)Vlad Emelianov2020-02-132-13/+52
| | | (Adapted from https://github.com/python/typing/pull/700)
* bpo-39524: Fixed doc-string in ast._pad_whitespace (GH-18340)mpheath2020-02-131-1/+1
|
* bpo-39606: allow closing async generators that are already closed (GH-18475)Nathaniel J. Smith2020-02-131-2/+28
| | | | | | | | | | | | | | The fix for [bpo-39386](https://bugs.python.org/issue39386) attempted to make it so you couldn't reuse a agen.aclose() coroutine object. It accidentally also prevented you from calling aclose() at all on an async generator that was already closed or exhausted. This commit fixes it so we're only blocking the actually illegal cases, while allowing the legal cases. The new tests failed before this patch. Also confirmed that this fixes the test failures we were seeing in Trio with Python dev builds: https://github.com/python-trio/trio/pull/1396 https://bugs.python.org/issue39606
* bpo-39184: Add audit events to functions in `fcntl`, `msvcrt`, `os`, ↵Saiyang Gou2020-02-131-0/+10
| | | | `resource`, `shutil`, `signal`, `syslog` (GH-18407)
* bpo-39474: Fix AST pos for expressions like (a)(b), (a)[b] and (a).b. (GH-18477)Serhiy Storchaka2020-02-121-0/+27
|
* bpo-18819: tarfile: only set device fields for device files (GH-18080)William Chargin2020-02-122-2/+56
| | | | | | The GNU docs describe the `devmajor` and `devminor` fields of the tar header struct only in the context of character and block special files, suggesting that in other cases they are not populated. Typical utilities behave accordingly; this patch teaches `tarfile` to do the same.
* bpo-21016: pydoc and trace use sysconfig (GH-18476)Victor Stinner2020-02-122-6/+5
| | | | | | | | bpo-21016, bpo-1294959: The pydoc and trace modules now use the sysconfig module to get the path to the Python standard library, to support uncommon installation path like /usr/lib64/python3.9/ on Fedora. Co-Authored-By: Jan Matějek <jmatejek@suse.com>
* bpo-32856: Optimize the assignment idiom in comprehensions. (GH-16814)Serhiy Storchaka2020-02-125-0/+79
| | | | | Now `for y in [expr]` in comprehensions is as fast as a simple assignment `y = expr`.
* bpo-39219: Fix SyntaxError attributes in the tokenizer. (GH-17828)Serhiy Storchaka2020-02-121-1/+13
| | | | * Always set the text attribute. * Correct the offset attribute for non-ascii sources.
* bpo-39567: Add audit for os.walk(), os.fwalk(), Path.glob() and ↵Serhiy Storchaka2020-02-122-3/+9
| | | | Path.rglob(). (GH-18372)
* bpo-39595: Improve zipfile.Path performance (#18406)Jason R. Coombs2020-02-126-68/+253
| | | | | | | | | | | | | | | | | | * Improve zipfile.Path performance on zipfiles with a large number of entries. * 📜🤖 Added by blurb_it. * Add bpo to blurb * Sync with importlib_metadata 1.5 (6fe70ca) * Update blurb. * Remove compatibility code * Add stubs module, omitted from earlier commit Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-39245: Switch to public API for Vectorcall (GH-18460)Petr Viktorin2020-02-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The bulk of this patch was generated automatically with: for name in \ PyObject_Vectorcall \ Py_TPFLAGS_HAVE_VECTORCALL \ PyObject_VectorcallMethod \ PyVectorcall_Function \ PyObject_CallOneArg \ PyObject_CallMethodNoArgs \ PyObject_CallMethodOneArg \ ; do echo $name git grep -lwz _$name | xargs -0 sed -i "s/\b_$name\b/$name/g" done old=_PyObject_FastCallDict new=PyObject_VectorcallDict git grep -lwz $old | xargs -0 sed -i "s/\b$old\b/$new/g" and then cleaned up: - Revert changes to in docs & news - Revert changes to backcompat defines in headers - Nudge misaligned comments
* bpo-39600: Adjust code, add idlelib/NEWS item (GH-18449)Terry Jan Reedy2020-02-112-4/+4
| | | Complete previous patch.
* bpo-38325: Skip non-BMP tests of test_winconsoleio (GH-18448)Victor Stinner2020-02-101-0/+6
| | | Skip tests on non-BMP characters of test_winconsoleio.
* bpo-39600, IDLE: Remove duplicated font names (GH-18430)Victor Stinner2020-02-101-2/+3
| | | In the font configuration window, remove duplicated font names.
* bpo-39586: Deprecate distutils bdist_msi command (GH-18415)Hugo van Kemenade2020-02-102-3/+12
|
* bpo-39590: make deque.__contains__ and deque.count hold strong references ↵sweeneyde2020-02-091-0/+12
| | | | (GH-18421)
* bpo-39579: Fix Attribute end_col_offset to point at the current node (GH-18405)Lysandros Nikolaou2020-02-071-0/+8
|
* bpo-39350: Fix fractions for int subclasses (GH-18375)Victor Stinner2020-02-072-7/+25
| | | | | | | Fix regression in fractions.Fraction if the numerator and/or the denominator is an int subclass. The math.gcd() function is now used to normalize the numerator and denominator. math.gcd() always return a int type. Previously, the GCD type depended on numerator and denominator.
* bpo-39491: Mention Annotated in get_origin() docstring (GH-18379)Jakub Stasiak2020-02-071-2/+2
| | | I forgot to do it in https://github.com/python/cpython/pull/18260.
* bpo-39274: Ensure Fraction.__bool__() returns a bool (GH-18017)Sebastian Berg2020-02-062-1/+40
| | | | | Some numerator types used (specifically NumPy) decides to not return a Python boolean for the "a != b" operation. Using the equivalent call to bool() guarantees a bool return also for such types.
* bpo-38149: Call sys.audit() only once per call for glob.glob(). (GH-18360)Serhiy Storchaka2020-02-061-1/+1
|
* bpo-39555: Fix distutils test to handle _d suffix on Windows debug build ↵Steve Dower2020-02-061-2/+2
| | | | (GH-18357)
* bpo-39559: Remove unused, undocumented argument from uuid.getnode (GH-18369)Shantanu2020-02-051-1/+1
|
* bpo-39488: Skip test_largefile tests if not enough disk space (GH-18261)Giampaolo Rodola2020-02-051-0/+18
|
* bpo-39505: delete the redundant '/' in $env:VIRTUAL_ENV (GH-18290)schwarzichet2020-02-051-1/+0
|
* bpo-39491: Merge PEP 593 (typing.Annotated) support (#18260)Jakub Stasiak2020-02-052-5/+355
| | | | | | | | | | | | | | | | | | | | | | | | | * bpo-39491: Merge PEP 593 (typing.Annotated) support PEP 593 has been accepted some time ago. I got a green light for merging this from Till, so I went ahead and combined the code contributed to typing_extensions[1] and the documentation from the PEP 593 text[2]. My changes were limited to: * removing code designed for typing_extensions to run on older Python versions * removing some irrelevant parts of the PEP text when copying it over as documentation and otherwise changing few small bits to better serve the purpose * changing the get_type_hints signature to match reality (parameter names) I wasn't entirely sure how to go about crediting the authors but I used my best judgment, let me know if something needs changing in this regard. [1] https://github.com/python/typing/blob/8280de241fd8c8afe727c7860254b753e383b360/typing_extensions/src_py3/typing_extensions.py [2] https://github.com/python/peps/blob/17710b879882454d55f82c2d44596e8e9f8e4bff/pep-0593.rst
* bpo-39184: Add audit events to command execution functions in os and pty ↵Saiyang Gou2020-02-051-0/+2
| | | | modules (GH-17824)
* closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH-18295)Philipp Gesang2020-02-041-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | When called on a closed object, readinto() segfaults on account of a write to a freed buffer: ==220553== Process terminating with default action of signal 11 (SIGSEGV): dumping core ==220553== Access not within mapped region at address 0x2A ==220553== at 0x48408A0: memmove (vg_replace_strmem.c:1272) ==220553== by 0x58DB0C: _buffered_readinto_generic (bufferedio.c:972) ==220553== by 0x58DCBA: _io__Buffered_readinto_impl (bufferedio.c:1053) ==220553== by 0x58DCBA: _io__Buffered_readinto (bufferedio.c.h:253) Reproducer: reader = open ("/dev/zero", "rb") _void = reader.read (42) reader.close () reader.readinto (bytearray (42)) ### BANG! The problem exists since 2012 when commit dc469454ec added code to free the read buffer on close(). Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com>
* bpo-39432: Implement PEP-489 algorithm for non-ascii "PyInit_*" symbol names ↵Stefan Behnel2020-02-042-1/+22
| | | | | | | | | in distutils (GH-18150) Make it export the correct init symbol also on Windows. https://bugs.python.org/issue39432
* bpo-38076 Clear the interpreter state only after clearing module globals ↵Eddie Elizondo2020-02-043-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (GH-18039) Currently, during runtime destruction, `_PyImport_Cleanup` is clearing the interpreter state before clearing out the modules themselves. This leads to a segfault on modules that rely on the module state to clear themselves up. For example, let's take the small snippet added in the issue by @DinoV : ``` import _struct class C: def __init__(self): self.pack = _struct.pack def __del__(self): self.pack('I', -42) _struct.x = C() ``` The module `_struct` uses the module state to run `pack`. Therefore, the module state has to be alive until after the module has been cleared out to successfully run `C.__del__`. This happens at line 606, when `_PyImport_Cleanup` calls `_PyModule_Clear`. In fact, the loop that calls `_PyModule_Clear` has in its comments: > Now, if there are any modules left alive, clear their globals to minimize potential leaks. All C extension modules actually end up here, since they are kept alive in the interpreter state. That means that we can't clear the module state (which is used by C Extensions) before we run that loop. Moving `_PyInterpreterState_ClearModules` until after it, fixes the segfault in the code snippet. Finally, this updates a test in `io` to correctly assert the error that it now throws (since it now finds the io module state). The test that uses this is: `test_create_at_shutdown_without_encoding`. Given this test is now working is a proof that the module state now stays alive even when `__del__` is called at module destruction time. Thus, I didn't add a new tests for this. https://bugs.python.org/issue38076
* Fixes in sorting descriptions (GH-18317)Stefan Pochmann2020-02-031-1/+1
| | | | | Improvements in listsort.txt and a comment in sortperf.py. Automerge-Triggered-By: @csabella
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-0313-29/+4
| | | | | | | | | | | Remove: * COUNT_ALLOCS macro * sys.getcounts() function * SHOW_ALLOC_COUNT code in listobject.c * SHOW_TRACK_COUNT code in tupleobject.c * PyConfig.show_alloc_count field * -X showalloccount command line option * @test.support.requires_type_collecting decorator
* bpo-39450 Stripped whitespace before parsing the docstring in ↵Steve Cirelli2020-02-032-1/+10
| | | | TestCase.shortDescription (GH-18175)
* bpo-39492: Fix a reference cycle between reducer_override and a Pickler ↵Pierre Glaser2020-02-021-0/+24
| | | | | | | | | | | | instance (GH-18266) This also needs a backport to 3.8 https://bugs.python.org/issue39492 Automerge-Triggered-By: @pitrou
* bpo-39349: Add *cancel_futures* to Executor.shutdown() (GH-18057)Kyle Stanley2020-02-023-2/+75
|
* bpo-34793: Drop old-style context managers in asyncio.locks (GH-17533)Andrew Svetlov2020-02-013-221/+40
|
* bpo-37224: Improve test__xxsubinterpreters.DestroyTests (GH-18058)Kyle Stanley2020-01-311-1/+5
| | | | | | Adds an additional assertion check based on a race condition for `test__xxsubinterpreters.DestroyTests.test_still_running` discovered in the bpo issue. https://bugs.python.org/issue37224
* bpo-38792: Remove IDLE shell calltip before new prompt. (#17150)Zackery Spytz2020-01-314-3/+7
| | | | | | | Previously, a calltip might be left after SyntaxError, KeyboardInterrupt, or Shell Restart. Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu> Co-authored-by: Tal Einat <taleinat+github@gmail.com>
* bpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282)Victor Stinner2020-01-301-1/+6
| | | | Skip test_zipfile.test_add_file_after_2107() if time.localtime() fails with OverflowError. It is the case on AIX 6.1 for example.
* bpo-39424: Use assertRaisesRegex instead of assertRaisesRegexp. (GH-18277)damani422020-01-301-1/+1
|
* bpo-39353: binascii.crc_hqx() is no longer deprecated (GH-18276)Victor Stinner2020-01-302-7/+2
| | | The binascii.crc_hqx() function is no longer deprecated.
* bpo-39493: Fix definition of IO.closed in typing.py (#18265)Shantanu2020-01-301-0/+1
|
* Get mock coverage back to 100% (GH-18228)Chris Withers2020-01-294-54/+35
| | | | | | | | | | | | | | | | * use the `: pass` and `: yield` patterns for code that isn't expected to ever be executed. * The _Call items passed to _AnyComparer are only ever of length two, so assert instead of if/else * fix typo * Fix bug, where stop-without-start patching dict blows up with `TypeError: 'NoneType' object is not iterable`, highlighted by lack of coverage of an except branch. * The fix for bpo-37972 means _Call.count and _Call.index are no longer needed. * add coverage for calling next() on a mock_open with readline.return_value set. * __aiter__ is defined on the Mock so the one on _AsyncIterator is never called.
* bpo-39485: fix corner-case in method-detection of mock (GH-18252)Carl Friedrich Bolz-Tereick2020-01-291-5/+1
| | | | | | | | | | | | | | Replace check for whether something is a method in the mock module. The previous version fails on PyPy, because there no method wrappers exist (everything looks like a regular Python-defined function). Thus the isinstance(getattr(result, '__get__', None), MethodWrapperTypes) check returns True for any descriptor, not just methods. This condition could also return erroneously True in CPython for C-defined descriptors. Instead to decide whether something is a method, just check directly whether it's a function defined on the class. This passes all tests on CPython and fixes the bug on PyPy.
* bpo-39460: Fix test_zipfile.test_add_file_after_2107() (GH-18247)Victor Stinner2020-01-291-0/+12
| | | | | | | | XFS filesystem is limited to 32-bit timestamp, but the utimensat() syscall doesn't fail. Moreover, there is a VFS bug which returns a cached timestamp which is different than the value on disk. https://bugzilla.redhat.com/show_bug.cgi?id=1795576 https://bugs.python.org/issue39460#msg360952
* bpo-36051: Drop GIL during large bytes.join() (GH-17757)Bruce Merry2020-01-291-2/+6
| | | | | Improve multi-threaded performance by dropping the GIL in the fast path of bytes.join. To avoid increasing overhead for small joins, it is only done if the output size exceeds a threshold.
* bpo-36350: inspect: Replace OrderedDict with dict. (GH-12412)Rémi Lapeyre2020-01-282-21/+23
|
* bpo-39439: Fix multiprocessing spawn path in a venv on Windows (GH-18158)Adam Meily2020-01-281-1/+1
|
* bpo-38883: Don't use POSIX `$HOME` in `pathlib.Path.home/expanduser` on ↵Christoph Reiter2020-01-282-11/+15
| | | | | | | | | Windows (GH-17961) In bpo-36264 os.path.expanduser was changed to ignore HOME on Windows. Path.expanduser/home still honored HOME despite being documented as behaving the same as os.path.expanduser. This makes them also ignore HOME so that both implementations behave the same way again.