summaryrefslogtreecommitdiffstats
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* bpo-39205: Tests that highlight a hang on ProcessPoolExecutor shutdown (#18221)Brian Quinlan2020-01-281-0/+20
|
* bpo-30780: Add IDLE configdialog tests (#3592)Cheryl Sabella2020-01-273-31/+148
| | | | | | | 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>
* bpo-39459: test.pythoninfo logs effective uid/gid (GH-18203)Victor Stinner2020-01-271-9/+14
| | | Fix also umask formatting: use octal prefix.
* bpo-39453: Add testcase for bpo-39453 (GH-18202)Dong-hee Na2020-01-271-0/+2
| | | | | | | | | https://bugs.python.org/issue39453 Automerge-Triggered-By: @pablogsal Automerge-Triggered-By: @pablogsal
* bpo-39453: Make list.__contains__ hold strong references to avoid crashes ↵Dong-hee Na2020-01-271-0/+5
| | | | (GH-18181)
* Clarify and fix assertions that mocks have not been awaited (GH-18196)Chris Withers2020-01-272-27/+30
| | | | | - 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
* Use relative imports in mock and its tests to help backporting (GH-18197)Chris Withers2020-01-273-79/+82
| | | | | | | | * asyncio.run only available in 3.8+ * iscoroutinefunction has important bungfixes in 3.8 * IsolatedAsyncioTestCase only available in 3.8+
* Fix so that test.test_distutils can be executed by unittest and not just ↵Toshio Kuratomi2020-01-271-0/+6
| | | | regrtest (GH-13480)
* bpo-39320: Handle unpacking of **values in compiler (GH-18141)Mark Shannon2020-01-272-4/+4
| | | | | | | | | | | | | * 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.
* bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock ↵Karthikeyan Singaravelan2020-01-272-0/+53
| | | | (#16029)
* Fix linecache.py add lazycache to __all__ and use dict.clear to clear the ↵加和2020-01-261-18/+18
| | | | cache (GH-4641)
* bpo-38932: Mock fully resets child objects on reset_mock(). (GH-17409)Vegard Stikbakke2020-01-252-2/+14
|
* Merge tag 'v3.9.0a3'Łukasz Langa2020-01-251-52/+115
|\ | | | | | | Python 3.9.0a3
| * Python 3.9.0a3v3.9.0a3Łukasz Langa2020-01-241-52/+115
| |
* | bpo-37955: correct mock.patch docs with respect to the returned type (GH-15521)Paulo Henrique Silva2020-01-251-1/+2
| |
* | bpo-39082: Allow AsyncMock to correctly patch static/class methods (GH-18116)Matthew Kokotovich2020-01-252-0/+25
| |
* | bpo-39388: IDLE: Fix bug when cancelling out of configdialog (GH-18068)Cheryl Sabella2020-01-253-8/+18
|/ | | | Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
* bpo-39430: Fix race condition in lazy imports in tarfile. (GH-18161)Serhiy Storchaka2020-01-241-10/+8
| | | Use `from ... import ...` to ensure module is fully loaded before accessing its attributes.
* bpo-39390 shutil: fix argument types for ignore callback (GH-18122)mbarkhau2020-01-242-1/+43
|
* bpo-38473: Handle autospecced functions and methods used with attach_mock ↵Karthikeyan Singaravelan2020-01-242-0/+33
| | | | (GH-16784)
* bpo-39395: putenv() and unsetenv() always available (GH-18135)Victor Stinner2020-01-243-31/+6
| | | | | | | | 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.
* bpo-39413: Implement os.unsetenv() on Windows (GH-18163)Victor Stinner2020-01-241-8/+35
| | | The os.unsetenv() function is now also available on Windows.
* bpo-39426: Fix outdated default and highest protocols in docs (GH-18154)Mark Dickinson2020-01-241-3/+3
| | | | | | 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
* Fix `mock.patch.dict` to be stopped with `mock.patch.stopall` (#17606)Mario Corchero2020-01-242-2/+67
| | | | | 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