summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* [3.9] bpo-41194: Convert _ast extension to PEP 489 (GH-21807)Victor Stinner2020-08-101-150/+176
| | | | | | | | | | | | * bpo-41194: Convert _ast extension to PEP 489 (GH-21293) Convert the _ast extension module to PEP 489 "Multiphase initialization". Replace the global _ast state with a module state. (cherry picked from commit b1cc6ba73a51d5cc3aeb113b5e7378fb50a0e20a) * bpo-41204: Fix compiler warning in ast_type_init() (GH-21307) (cherry picked from commit 1f76453173267887ed05bb3783e862cb22365ae8)
* Fix -Wstrict-prototypes warning in thread_pthread.h. (GH-21477)Miss Islington (bot)2020-07-151-1/+1
| | | | | (cherry picked from commit ea62a4bd54421693ed6b24a1bbd18ebed3bdb8f8) Co-authored-by: Benjamin Peterson <benjamin@python.org>
* [3.9] bpo-41218: Only mark async code with CO_COROUTINE. (GH-21357) (GH-21362)Pablo Galindo2020-07-061-4/+6
| | | | | | | | | | 3.8.3 had a regression where compiling with ast.PyCF_ALLOW_TOP_LEVEL_AWAIT woudl agressively mark things are coroutine even if there were not. (cherry picked from commit bd46174) Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com> Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
* bpo-29778: Ensure python3.dll is loaded from correct locations when Python ↵Miss Islington (bot)2020-07-062-48/+0
| | | | | | | | | is embedded (GH-21297) Also enables using debug build of `python3_d.dll` Reference: CVE-2020-15523 (cherry picked from commit dcbaa1b49cd9062fb9ba2b9d49555ac6cd8c60b5) Co-authored-by: Steve Dower <steve.dower@python.org>
* bpo-21222: Fix improperly merged change so that final hooks are called ↵Steve Dower2020-07-031-2/+2
| | | | before types are cleared (GH-21304)
* bpo-41162: Clear audit hooks later during finalization (GH-21222)Steve Dower2020-07-031-3/+7
| | | Co-authored-by: Konge <zkonge@outlook.com>
* bpo-41180: Audit code.__new__ when unmarshalling (GH-21271)Miss Islington (bot)2020-07-031-0/+6
| | | | | (cherry picked from commit d160e0f8e283d0a8737644588b38e8c6a07c134f) Co-authored-by: tkmikan <36260601+tkmikan@users.noreply.github.com>
* [3.9] bpo-41194: The _ast module cannot be loaded more than once (GH-21290) ↵Victor Stinner2020-07-031-2006/+1900
| | | | | | | | | | | | | | | | | | | | | | | (GH-21292) * bpo-41194: Pass module state in Python-ast.c (GH-21284) Rework asdl_c.py to pass the module state to functions in Python-ast.c, instead of using astmodulestate_global. Handle also PyState_AddModule() failure in init_types(). (cherry picked from commit 74419f0c64959bb8392fcf3659058410423038e1) * bpo-41194: The _ast module cannot be loaded more than once (GH-21290) Fix a crash in the _ast module: it can no longer be loaded more than once. It now uses a global state rather than a module state. * Move _ast module state: use a global state instead. * Set _astmodule.m_size to -1, so the extension cannot be loaded more than once. (cherry picked from commit 91e1bc18bd467a13bceb62e16fbc435b33381c82)
* [3.9] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags ↵Guido van Rossum2020-06-282-2/+3
| | | | (#21022)
* [3.9] bpo-41076: Pre-feed the parser with the f-string expression location ↵Pablo Galindo2020-06-282-2446/+2445
| | | | | | (GH-21054) (GH-21190) This commit changes the parsing of f-string expressions with the new parser. The parser gets pre-fed with the location of the expression itself (not the f-string, which was what we were doing before). This allows us to completely skip the shifting of the AST nodes after the parsing is completed.. (cherry picked from commit 1f0f4abb110b9fbade6175842b6a26ab0b8df6dd)
* [3.9] bpo-41132: Use pymalloc allocator in the f-string parser (GH-21173) ↵Lysandros Nikolaou2020-06-271-7/+7
| | | | | | | (GH-21183) (cherry picked from commit 6dcbc2422de9e2a7ff89a4689572d84001e230b2) Automerge-Triggered-By: @pablogsal
* bpo-41094: Fix decoding errors with audit when open files. (GH-21095)Miss Islington (bot)2020-06-241-4/+19
| | | | | (cherry picked from commit 6c6810d98979add7a89391c3c38990d0859f7a29) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-41061: Fix incorrect expressions in hashtable (GH-21028)Miss Islington (bot)2020-06-221-2/+2
| | | | | | Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 4901ea952691ad70aae21cfe04b6bd363b5a6aff) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-41056: Fix reference to deallocated stack in pathconfig (Coverity) ↵Miss Islington (bot)2020-06-221-1/+1
| | | | | | | | | | (GH-21013) Reported by Coverity. (CID 1457554 RETURN_LOCAL) path0 is assigned as a pointer to this right before it goes out of scope. (cherry picked from commit 81328f30703bd7225e7e73aedb0994a7293ce190) Co-authored-by: Gregory P. Smith <greg@krypto.org>
* bpo-36346: Add Py_DEPRECATED to deprecated unicode APIs (GH-20878)Inada Naoki2020-06-181-0/+4
| | | | | Co-authored-by: Kyle Stanley <aeros167@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> (cherry picked from commit 2c4928d37edc5e4aeec3c0b79fa3460b1ec9b60d)
* bpo-40985: Show correct SyntaxError text when last line has a LINECONT ↵Miss Islington (bot)2020-06-161-4/+8
| | | | | | | | | | (GH-20888) When a file ends with a line that contains a line continuation character the text of the emitted SyntaxError is empty, contrary to the old parser, where the error text contained the text of the last line. (cherry picked from commit 113e2b0a07c72c0d5e3489076afb14f6b3ad1049) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-36020: Remove snprintf macro in pyerrors.h (GH-20889)Miss Islington (bot)2020-06-151-10/+17
| | | | | | | | | | | | | On Windows, GH-include "pyerrors.h" no longer defines "snprintf" and "vsnprintf" macros. PyOS_snprintf() and PyOS_vsnprintf() should be used to get portable behavior. Replace snprintf() calls with PyOS_snprintf() and replace vsnprintf() calls with PyOS_vsnprintf(). (cherry picked from commit e822e37946f27c09953bb5733acf3b07c2db690f) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40910: PyConfig_Clear() clears _orig_argv (GH-20886)Miss Islington (bot)2020-06-151-0/+2
| | | | | | bpo-40910, bpo-40953: PyConfig_Clear() clears _orig_argv. (cherry picked from commit e2d47a0568c6da9229580829917fd6aa702133b3) Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-40957: Fix refleak in _Py_fopen_obj() (GH-20827)Miss Islington (bot)2020-06-131-0/+1
| | | | | | Signed-off-by: Christian Heimes <christian@python.org> (cherry picked from commit 9672912e8f90374fd31b37ca0fb7cefbc6f4c555) Co-authored-by: Christian Heimes <christian@python.org>
* bpo-40834: Fix truncate when sending str object with channel (GH-20555)Miss Islington (bot)2020-06-131-1/+1
| | | | | (cherry picked from commit 29c117202e386bad1d66ae336e2fefa1a1809ee0) Co-authored-by: An Long <aisk@users.noreply.github.com>
* [3.9] bpo-40924: Revert "bpo-39791 native hooks for ↵Łukasz Langa2020-06-092-2005/+2168
| | | | | | importlib.resources.files (GH-20576)" (#20760) This reverts commit 9cf1be46e3692d565461afd3afa326d124d743dd due to https://bugs.python.org/issue40924.
* bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var ↵Victor Stinner2020-06-082-7/+27
| | | | | | | (GH-20605) (GH-20725) (cherry picked from commit 8f023a2f664f902a3d0b7a6f64d63afc0d1c15ae) Co-authored-by: Sandro Mani <manisandro@gmail.com>
* bpo-40910: Export Py_GetArgcArgv() function (GH-20721) (GH-20723)Victor Stinner2020-06-083-18/+28
| | | | | | | | | | | | | | Export explicitly the Py_GetArgcArgv() function to the C API and document the function. Previously, it was exported implicitly which no longer works since Python is built with -fvisibility=hidden. * Add PyConfig._orig_argv member. * Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice. * PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now _PyConfig_Write() responsibility. * _PyConfig_Write() result type becomes PyStatus instead of void. * Write an unit test on Py_GetArgcArgv(). (cherry picked from commit e81f6e687d0f04a45f2389d0b43fafd6d8491624)
* bpo-39791 native hooks for importlib.resources.files (GH-20576)Miss Islington (bot)2020-06-082-2168/+2005
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * Provide native .files support on SourceFileLoader. * Add native importlib.resources.files() support to zipimporter. Remove fallback support. * make regen-all * 📜🤖 Added by blurb_it. * Move 'files' into the ResourceReader so it can carry the relevant module name context. * Create 'importlib.readers' module and add FileReader to it. * Add zip reader and rely on it for a TraversableResources object on zipimporter. * Remove TraversableAdapter, no longer needed. * Update blurb. * Replace backslashes with forward slashes. * Incorporate changes from importlib_metadata 2.0, finalizing the interface for extension via get_resource_reader. Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> (cherry picked from commit 843c27765652e2322011fb3e5d88f4837de38c06) Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
* bpo-40870: Invalidate usage of some constants with ast.Name (GH-20649)Miss Islington (bot)2020-06-061-0/+22
| | | | | (cherry picked from commit 68874a8502da440a1dc4746cf73262648b870aee) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
* [3.9] bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578) (GH-20618)Victor Stinner2020-06-034-28/+18
| | | | | | | | | | | | | | | * bpo-40826: Add _Py_EnsureTstateNotNULL() macro (GH-20571) Add _Py_EnsureTstateNotNULL(tstate) macro: call Py_FatalError() if tstate is NULL, the error message contains the current function name. (cherry picked from commit 3026cad59b87751a9215111776cac8e819458fce) * bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578) PyOS_InterruptOccurred() now fails with a fatal error if it is called with the GIL released. (cherry picked from commit cbe129692293251e7fbcea9ff0d822824d90c140)
* [3.9] Fix MSVC warnings in pythonrun.c (GH-20587) (GH-20592)Ammar Askar2020-06-031-8/+8
| | | (cherry picked from commit 90d297012b3848454)
* Make sure that keyword arguments are merged into the arguments dictionary ↵Miss Islington (bot)2020-06-011-0/+3
| | | | | | | when dict unpacking and keyword arguments are interleaved. (GH-20553) (GH-20569) (cherry picked from commit db64f12e4deda2abbafb6d2bd5c06762fca991ff) Co-authored-by: Mark Shannon <mark@hotpy.org>
* bpo-40780: Fix failure of _Py_dg_dtoa to remove trailing zeros (GH-20435) ↵Miss Islington (bot)2020-05-291-0/+11
| | | | | | | | | | | | | | | | (GH-20514) * Fix failure of _Py_dg_dtoa to remove trailing zeros * Add regression test and news entry * Add explanation about why it's safe to strip trailing zeros * Make code safer, clean up comments, add change note at top of file * Nitpick: avoid implicit int-to-float conversion in tests (cherry picked from commit 895c9c1d438367722f74f437fda96767d770662b) Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
* bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for ↵Miss Islington (bot)2020-05-281-0/+1
| | | | | | | | | | | | PyType_FromSpec types (reverts GH-19414) (GH-20264) Heap types now always visit the type in tp_traverse. See added docs for details. This reverts commit 0169d3003be3d072751dd14a5c84748ab63a249f. Automerge-Triggered-By: @encukou (cherry picked from commit 1cf15af9a6f28750f37b08c028ada31d38e818dd) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.9] bpo-40614: Respect feature version for f-string debug expressions ↵Pablo Galindo2020-05-271-0/+6
| | | | | | | | | (GH-20196) (GH-20464) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com> (cherry picked from commit c116c94) Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
* bpo-36290: Fix keytword collision handling in AST node constructors (GH-12382)Miss Islington (bot)2020-05-241-3/+24
| | | | | (cherry picked from commit c73914a562580ae72048876cb42ed8e76e2c83f9) Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
* bpo-40696: Fix a hang that can arise after gen.throw() (GH-20287)Miss Islington (bot)2020-05-221-9/+53
| | | | | | | | | | This updates _PyErr_ChainStackItem() to use _PyErr_SetObject() instead of _PyErr_ChainExceptions(). This prevents a hang in certain circumstances because _PyErr_SetObject() performs checks to prevent cycles in the exception context chain while _PyErr_ChainExceptions() doesn't. (cherry picked from commit 7c30d12bd5359b0f66c4fbc98aa055398bcc8a7e) Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
* [3.9] bpo-40514: Remove --with-experimental-isolated-subinterpreters in 3.9 ↵Victor Stinner2020-05-195-102/+0
| | | | | | | (GH-20228) Remove --with-experimental-isolated-subinterpreters configure option in Python 3.9: the experiment continues in the master branch, but it's no longer needed in 3.9.
* bpo-40663: Correctly handle annotations with subscripts in ast_unparse.c ↵Batuhan Taskaya2020-05-181-1/+12
| | | | (GH-20156)
* bpo-35890: Use RegQueryInfoKeyW and CryptAcquireContextW explicitly (GH-19974)Minmin Gong2020-05-181-2/+2
|
* bpo-40650: Include winsock2.h in pytime.c, instead of a full windows.h ↵Minmin Gong2020-05-181-1/+1
| | | | (GH-20137)
* bpo-31033: Improve the traceback for cancelled asyncio tasks (GH-19951)Chris Jerdonek2020-05-181-0/+14
| | | | | When an asyncio.Task is cancelled, the exception traceback now starts with where the task was first interrupted. Previously, the traceback only had "depth one."
* bpo-40636: Clarify the zip built-in docstring. (GH-20118)Gregory P. Smith2020-05-151-5/+8
| | | | | | | | | | | | | | | | | | | | | Clarify the zip built-in docstring. This puts much simpler text up front along with an example. As it was, the zip built-in docstring was technically correct. But too technical for the reader who shouldn't _need_ to know about `__next__` and `StopIteration` as most people do not need to understand the internal implementation details of the iterator protocol in their daily life. This is a documentation only change, intended to be backported to 3.8; it is only tangentially related to PEP-618 which might offer new behavior options in the future. Wording based a bit more on enumerate per Brandt's suggestion. This gets rid of the legacy wording paragraph which seems too tied to implementation details of the iterator protocol which isn't relevant here. Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
* Fix typo in code comment in main_loop label. (GH-20068)Chris Jerdonek2020-05-151-1/+1
|
* bpo-40612: Fix SyntaxError edge cases in traceback formatting (GH-20072)Guido van Rossum2020-05-151-19/+47
| | | | | | | | | | | | | This fixes both the traceback.py module and the C code for formatting syntax errors (in Python/pythonrun.c). They now both consistently do the following: - Suppress caret if it points left of text - Allow caret pointing just past end of line - If caret points past end of line, clip to *just* past end of line The syntax error formatting code in traceback.py was mostly rewritten; small, subtle changes were applied to the C code in pythonrun.c. There's still a difference when the text contains embedded newlines. Neither handles these very well, and I don't think the case occurs in practice. Automerge-Triggered-By: @gvanrossum
* bpo-40334: Correctly identify invalid target in assignment errors (GH-20076)Pablo Galindo2020-05-151-5/+8
| | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40602: _Py_hashtable_set() reports rehash failure (GH-20077)Victor Stinner2020-05-141-9/+17
| | | | If _Py_hashtable_set() fails to grow the hash table (rehash), it now fails rather than ignoring the error.
* bpo-40602: Write unit tests for _Py_hashtable_t (GH-20091)Victor Stinner2020-05-142-109/+51
| | | | | | | Cleanup also hashtable.c. Rename _Py_hashtable_t members: * Rename entries to nentries * Rename num_buckets to nbuckets
* bpo-40602: Optimize _Py_hashtable_get_ptr() (GH-20066)Victor Stinner2020-05-131-24/+23
| | | | | | | _Py_hashtable_get_entry_ptr() avoids comparing the entry hash: compare directly keys. Move _Py_hashtable_get_entry_ptr() just after _Py_hashtable_get_entry_generic().
* bpo-40609: _Py_hashtable_t values become void* (GH-20065)Victor Stinner2020-05-132-99/+41
| | | | | | | | | | | | | | | | | | | | | _Py_hashtable_t values become regular "void *" pointers. * Add _Py_hashtable_entry_t.data member * Remove _Py_hashtable_t.data_size member * Remove _Py_hashtable_t.get_func member. It is no longer needed to specialize _Py_hashtable_get() for a specific value size, since all entries now have the same size (void*). * Remove the following macros: * _Py_HASHTABLE_GET() * _Py_HASHTABLE_SET() * _Py_HASHTABLE_SET_NODATA() * _Py_HASHTABLE_POP() * Rename _Py_hashtable_pop() to _Py_hashtable_steal() * _Py_hashtable_foreach() callback now gets key and value rather than entry. * Remove _Py_hashtable_value_destroy_func type. value_destroy_func callback now only has a single parameter: data (void*).
* bpo-40609: _tracemalloc allocates traces (GH-20064)Victor Stinner2020-05-131-49/+0
| | | | | | | | | | | | | Rewrite _tracemalloc to store "trace_t*" rather than directly "trace_t" in traces hash tables. Traces are now allocated on the heap memory, outside the hash table. Add tracemalloc_copy_traces() and tracemalloc_copy_domains() helper functions. Remove _Py_hashtable_copy() function since there is no API to copy a key or a value. Remove also _Py_hashtable_delete() function which was commented.
* bpo-40609: Add destroy functions to _Py_hashtable (GH-20062)Victor Stinner2020-05-132-23/+38
| | | | | | Add key_destroy_func and value_destroy_func parameters to _Py_hashtable_new_full(). marshal.c and _tracemalloc.c use these destroy functions.
* bpo-40609: Remove _Py_hashtable_t.key_size (GH-20060)Victor Stinner2020-05-132-68/+49
| | | | | | | | | | Rewrite _Py_hashtable_t type to always store the key as a "const void *" pointer. Add an explicit "key" member to _Py_hashtable_entry_t. Remove _Py_hashtable_t.key_size member. hash and compare functions drop their hash table parameter, and their 'key' parameter type becomes "const void *".
* bpo-40602: Add _Py_HashPointerRaw() function (GH-20056)Victor Stinner2020-05-122-5/+11
| | | | | Add a new _Py_HashPointerRaw() function which avoids replacing -1 with -2 to micro-optimize hash table using pointer keys: using _Py_hashtable_hash_ptr() hash function.