summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* bpo-39553: Delete HAVE_SXS protected code (GH-18356)Zackery Spytz2020-02-054-95/+1
| | | | | | | https://bugs.python.org/issue39553 Automerge-Triggered-By: @zooba
* bpo-39491: Merge PEP 593 (typing.Annotated) support (#18260)Jakub Stasiak2020-02-055-6/+467
| | | | | | | | | | | | | | | | | | | | | | | | | * 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-39185 Add the d[etailed] and q[uiet] verbosity levels for msbuild (GH-17791)Anthony Shaw2020-02-052-0/+5
|
* bpo-39184: Add audit events to command execution functions in os and pty ↵Saiyang Gou2020-02-055-7/+56
| | | | modules (GH-17824)
* bpo-39542: Make _Py_NewReference() opaque in C API (GH-18346)Victor Stinner2020-02-055-55/+54
| | | | | | | | | | _Py_NewReference() becomes a regular opaque function, rather than a static inline function in the C API (object.h), to better hide implementation details. Move _Py_tracemalloc_config from public pymem.h to internal pycore_pymem.h header. Make _Py_AddToAllObjects() private.
* Fix MinGW library generation command (GH-17917)Baljak2020-02-051-1/+1
| | | To print the exports to stdout, the gendef command requires the option "-". Without this option, no output is generated.
* closes bpo-39510: Fix use-after-free in BufferedReader.readinto() (GH-18295)Philipp Gesang2020-02-043-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | 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-043-1/+23
| | | | | | | | | in distutils (GH-18150) Make it export the correct init symbol also on Windows. https://bugs.python.org/issue39432
* Restore PyObject_IsInstance() comment (GH-18345)Victor Stinner2020-02-041-17/+23
| | | | | | | | | | | | Restore PyObject_IsInstance() comment explaining why only tuples of types are accepted, but not general sequence. Comment written by Guido van Rossum in commit 03290ecbf1661c0192e6abdbe00ae163af461d77 which implements isinstance(x, (A, B, ...)). The comment was lost in a PyObject_IsInstance() optimization: commit ec569b794737be248671d0dfac11b664fc930eef. Cleanup also the code. recursive_isinstance() is no longer recursive, so rename it to object_isinstance(), whereas object_isinstance() is recursive and so rename it to object_recursive_isinstance().
* bpo-38076 Clear the interpreter state only after clearing module globals ↵Eddie Elizondo2020-02-045-3/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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
* add whatsnew that was missed from 31d6de5aba009914efa8f0f3c3d7da35217578eb ↵Chris Withers2020-02-041-0/+2
| | | | (#18344)
* bpo-38558: Link to further docs from walrus operator mention in tutorial ↵Adorilson Bezerra2020-02-032-3/+6
| | | | (GH-16973)
* bpo-39542: Simplify _Py_NewReference() (GH-18332)Victor Stinner2020-02-037-58/+60
| | | | | | | | | * Remove _Py_INC_REFTOTAL and _Py_DEC_REFTOTAL macros: modify directly _Py_RefTotal. * _Py_ForgetReference() is no longer defined if the Py_TRACE_REFS macro is not defined. * Remove _Py_NewReference() implementation from object.c: unify the two implementations in object.h inline function. * Fix Py_TRACE_REFS build: _Py_INC_TPALLOCS() macro has been removed.
* Fixes in sorting descriptions (GH-18317)Stefan Pochmann2020-02-032-9/+9
| | | | | Improvements in listsort.txt and a comment in sortperf.py. Automerge-Triggered-By: @csabella
* bpo-39542: Move object.h debug functions to internal C API (GH-18331)Victor Stinner2020-02-034-7/+11
| | | | | | | | Move the following functions from the public C API to the internal C API: * _PyDebug_PrintTotalRefs(), * _Py_PrintReferenceAddresses() * _Py_PrintReferences()
* bpo-39489: Remove COUNT_ALLOCS special build (GH-18259)Victor Stinner2020-02-0334-469/+24
| | | | | | | | | | | 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-36051: Fix compiler warning. (GH-18325)Inada Naoki2020-02-031-1/+1
|
* bpo-39450 Stripped whitespace before parsing the docstring in ↵Steve Cirelli2020-02-033-1/+12
| | | | TestCase.shortDescription (GH-18175)
* bpo-39492: Fix a reference cycle between reducer_override and a Pickler ↵Pierre Glaser2020-02-023-4/+43
| | | | | | | | | | | | 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-026-3/+101
|
* Fix 5-space indentation and trailing whitespace (GH-18311)Mark Dickinson2020-02-021-11/+11
|
* bpo-39496: Remove redundant checks from _sqlite/cursor.c (GH-18270)Alex Henrie2020-02-011-20/+6
|
* fixes typos in http.client documentation (#18300)James Corbett2020-02-011-2/+2
|
* bpo-34793: Drop old-style context managers in asyncio.locks (GH-17533)Andrew Svetlov2020-02-016-223/+50
|
* Update sum comment. (#18240)Brandt Bucher2020-02-011-1/+5
|
* bpo-39511: PyThreadState_Clear() calls on_delete (GH-18296)Victor Stinner2020-02-013-3/+12
| | | | | | | | | | | | | | | | | | PyThreadState.on_delete is a callback used to notify Python when a thread completes. _thread._set_sentinel() function creates a lock which is released when the thread completes. It sets on_delete callback to the internal release_sentinel() function. This lock is known as Threading._tstate_lock in the threading module. The release_sentinel() function uses the Python C API. The problem is that on_delete is called late in the Python finalization, when the C API is no longer fully working. The PyThreadState_Clear() function now calls the PyThreadState.on_delete callback. Previously, that happened in PyThreadState_Delete(). The release_sentinel() function is now called when the C API is still fully working.
* bpo-39511: Fix multiprocessing semlock_acquire() (GH-18298)Victor Stinner2020-02-011-10/+11
| | | | The Python C API must not be used when the GIL is released: only access Py_None when the GIL is hold.
* 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
* Doc: Fix s/pseudo random/pseudo-random/ (GH-18289)Julien Palard2020-01-311-2/+2
|
* bpo-38792: Remove IDLE shell calltip before new prompt. (#17150)Zackery Spytz2020-01-315-3/+9
| | | | | | | 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-39487: Merge duplicated _Py_IDENTIFIER identifiers in C code (GH-18254)Hai Shi2020-01-3012-34/+24
| | | Moving repetitive `_Py_IDENTIFIER` instances to a global location helps identify them more easily in regards to sub-interpreter support.
* bpo-39502: Skip test_zipfile.test_add_file_after_2107() on AIX (GH-18282)Victor Stinner2020-01-302-1/+8
| | | | 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-39434: Improve float __floordiv__ performance and error message (GH-18147)Dong-hee Na2020-01-302-31/+42
|
* bpo-38631: Add _Py_NO_RETURN to functions calling Py_FatalError() (GH-18278)Victor Stinner2020-01-304-20/+6
| | | | | | | | | Add _Py_NO_RETURN to functions calling Py_FatalError(): * _PyObject_AssertFailed() * dummy_dealloc() * faulthandler_fatal_error_thread() * none_dealloc() * notimplemented_dealloc()
* bpo-38631: Replace Py_FatalError() with assert() in ceval.c (GH-18279)Victor Stinner2020-01-302-11/+5
| | | | | | | Replace a few Py_FatalError() calls if tstate is NULL with assert(tstate != NULL) in ceval.c. PyEval_AcquireThread(), PyEval_ReleaseThread() and PyEval_RestoreThread() must never be called with a NULL tstate.
* bpo-38631: Avoid Py_FatalError() in unicodeobject.c (GH-18281)Victor Stinner2020-01-301-23/+28
| | | | | Replace Py_FatalError() calls with _PyErr_WriteUnraisableMsg(), _PyObject_ASSERT_FAILED_MSG() or Py_UNREACHABLE() in unicode_dealloc() and unicode_release_interned().
* bpo-39424: Use assertRaisesRegex instead of assertRaisesRegexp. (GH-18277)damani422020-01-301-1/+1
|
* bpo-39497: Remove unused variable from pysqlite_cursor_executescript (GH-18271)Alex Henrie2020-01-301-3/+0
|
* bpo-39353: binascii.crc_hqx() is no longer deprecated (GH-18276)Victor Stinner2020-01-306-15/+3
| | | The binascii.crc_hqx() function is no longer deprecated.
* bpo-38631: Replace tp_new_wrapper() fatal error with SystemError (GH-18262)Victor Stinner2020-01-301-2/+6
| | | | tp_new_wrapper() now raises a SystemError if called with non-type self, rather than calling Py_FatalError() which cannot be catched.
* bpo-38631: Avoid Py_FatalError() in init_slotdefs() (GH-18263)Victor Stinner2020-01-303-16/+26
| | | | | | Rename init_slotdefs() to _PyTypes_InitSlotDefs() and add a return value of type PyStatus. The function is now called exactly once from _PyTypes_Init(). Replace calls to init_slotdefs() with an assertion checking that slotdefs is initialized.
* bpo-38631: Replace Py_FatalError() with _PyObject_ASSERT_FAILED_MSG() (GH-18258)Victor Stinner2020-01-302-32/+32
| | | | | | | | | | | | | | Replace Py_FatalError() with _PyObject_ASSERT_FAILED_MSG() in object.c and typeobject.c to also dump the involved Python object on a fatal error. It should ease debug when such fatal error occurs. If the double linked list is inconsistent, _Py_ForgetReference() no longer dumps previous and next objects in the fatal error, it now only dumps the current object. It ensures that the error message is displayed even if dumping the object does crash Python. Enhance _Py_ForgetReference() error messages; _PyObject_ASSERT_FAILED_MSG() logs the "_Py_ForgetReference" function name.
* bpo-39494: Remove extra null terminators from kwlist vars (GH-18267)Alex Henrie2020-01-302-3/+3
|
* bpo-39493: Fix definition of IO.closed in typing.py (#18265)Shantanu2020-01-302-0/+2
|
* Improve grammar in the import system reference documentation (GH-18209)Bonifacio de Oliveira2020-01-301-1/+1
| | | | | Replaced the period with a comma. Automerge-Triggered-By: @Mariatta
* Remove deadcode in _Py_inc_count() (GH-18257)Victor Stinner2020-01-291-2/+0
| | | | (tp->tp_next != NULL) check became redundant with commit 45294a9562e5c360ee8ef8498d8792e05a6eb25e (merged in 2006).
* 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-292-5/+4
| | | | | | | | | | | | | | 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
* Doc: Fix external links to functional programming tutorial. (GH-18249)Julien Palard2020-01-291-3/+3
|