summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-106905: Use separate structs to track recursion depth in each ↵Serhiy Storchaka2023-12-251-300/+379
| | | | | | | | | PyAST_mod2obj call. (GH-113035) (GH-113472) (cherry picked from commit 48c49739f5502fc7aa82f247ab2e4d7b55bdca62) Co-authored-by: Yilei Yang <yileiyang@google.com> Co-authored-by: Gregory P. Smith [Google LLC] <greg@krypto.org>
* [3.12] gh-113297: Fix segfault in compiler for with statement with 19 ↵Irit Katriel2023-12-231-0/+1
| | | | context managers (#113327) (#113404)
* [3.12] gh-113343: Fix error check on mmap(2) (GH-113342) (#113374)Miss Islington (bot)2023-12-211-1/+1
| | | | | | | | | | | | | | | | | gh-113343: Fix error check on mmap(2) (GH-113342) Fix error check on mmap(2) It should check MAP_FAILED instead of NULL for error. On mmap(2) man page: RETURN VALUE On success, mmap() returns a pointer to the mapped area. On error, the value MAP_FAILED (that is, (void *) -1) is returned, and errno is set to indicate the error. (cherry picked from commit 6b70c3dc5ab2f290fcdbe474bcb7d6fdf29eae4c) Co-authored-by: Namhyung Kim <namhyung@gmail.com>
* [3.12] gh-112716: Fix SystemError when __builtins__ is not a dict ↵Serhiy Storchaka2023-12-141-9/+5
| | | | | | | | | (GH-112770) (GH-113103) It was raised in two cases: * in the import statement when looking up __import__ * in pickling some builtin type when looking up built-ins iter, getattr, etc. (cherry picked from commit 1161c14e8c68296fc465cd48970b32be9bee012e)
* [3.12] gh-112943: Correctly compute end offsets for multiline tokens in the ↵Pablo Galindo Salgado2023-12-111-1/+1
| | | | | tokenize module (GH-112949) (#112957) (cherry picked from commit a135a6d2c6d503b186695f01efa7eed65611b04e)
* [3.12] gh-106560: Fix redundant declarations in Python/frozen.c (#112612) ↵Victor Stinner2023-12-031-6/+0
| | | | | | | | | | | | (#112651) gh-106560: Fix redundant declarations in Python/frozen.c (#112612) Avoid duplicated declarations of "extern" functions in Python/frozen.c. Compiler warnings seen by building Python with gcc -Wredundant-decls. (cherry picked from commit d9e444dbb86e173ee5b8491e3facbd447b91eaed)
* [3.12] gh-112367: Only free perf trampoline arenas at shutdown (GH-112368) ↵Pablo Galindo Salgado2023-12-012-5/+35
| | | | | | | (#112590) (cherry picked from commit a73aa48e6bec900be7edd3431deaa5fc1d809e6f) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* [3.12] gh-112356: LOAD_GLOBAL can only include one PUSH_NULL (#112566)Dennis Sweeney2023-12-011-2/+2
|
* [3.12] gh-110310: Add a Per-Interpreter XID Registry for Heap Types ↵Eric Snow2023-11-281-38/+120
| | | | | | | | | | | | | | | (gh-110311) (gh-110714) We do the following: * add a per-interpreter XID registry (PyInterpreterState.xidregistry) * put heap types there (keep static types in _PyRuntimeState.xidregistry) * clear the registries during interpreter/runtime finalization * avoid duplicate entries in the registry (when _PyCrossInterpreterData_RegisterClass() is called more than once for a type) * use Py_TYPE() instead of PyObject_Type() in _PyCrossInterpreterData_Lookup() The per-interpreter registry helps preserve isolation between interpreters. This is important when heap types are registered, which is something we haven't been doing yet but I will likely do soon. (cherry-picked from commit 80dc39e1dc2abc809f448cba5d2c5b9c1c631e11)
* [3.12] gh-105716: Support Background Threads in Subinterpreters Consistently ↵Eric Snow2023-11-281-0/+37
| | | | | | | | | (gh-109921) (gh-110707) The existence of background threads running on a subinterpreter was preventing interpreters from getting properly destroyed, as well as impacting the ability to run the interpreter again. It also affected how we wait for non-daemon threads to finish. We add PyInterpreterState.threads.main, with some internal C-API functions. (cherry-picked from commit 1dd9dee45d2591b4e701039d1673282380696849)
* [3.12] gh-109793: Allow Switching Interpreters During Finalization ↵Eric Snow2023-11-281-1/+16
| | | | | (gh-109794) (gh-110705) Essentially, we should check the thread ID rather than the thread state pointer.
* [3.12] gh-106931: Intern Statically Allocated Strings Globally (gh-107272) ↵Eric Snow2023-11-271-0/+7
| | | | | | | | | (gh-110713) We tried this before with a dict and for all interned strings. That ran into problems due to interpreter isolation. However, exclusively using a per-interpreter cache caused some inconsistency that can eliminate the benefit of interning. Here we circle back to using a global cache, but only for statically allocated strings. We also use a more-basic _Py_hashtable_t for that global cache instead of a dict. Ideally we would only have the global cache, but the optional isolation of each interpreter's allocator means that a non-static string object must not outlive its interpreter. Thus we would have to store a copy of each such interned string in the global cache, tied to the main interpreter. (cherry-picked from commit b72947a8d26915156323ccfd04d273199ecb870c)
* [3.12] gh-109853: Fix sys.path[0] For Subinterpreters (gh-109994) (gh-110701)Eric Snow2023-11-272-0/+30
| | | | | | | This change makes sure sys.path[0] is set properly for subinterpreters. Before, it wasn't getting set at all. This change does not address the broader concerns from gh-109853. (cherry-picked from commit a040a32ea2f13f16172394d3e3e3f80f47f25a68)
* [3.12] gh-76785: Use Pending Calls When Releasing Cross-Interpreter Data ↵Eric Snow2023-11-271-33/+58
| | | | | | (gh-109556) (gh-112288) This fixes some crashes in the _xxinterpchannels module, due to a race between interpreters. (cherry picked from commit fd7e08a6f35581e1189b9bf12feb51f7167a86c5)
* [3.12] gh-112438: Fix support of format units with the "e" prefix in nested ↵Miss Islington (bot)2023-11-271-1/+1
| | | | | | | tuples in PyArg_Parse (gh-112439) (GH-112460) (cherry picked from commit 4eea1e82369fbf7a795d1956e7a8212a1b58009f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* gh-111856: Fix os.fstat on windows with FAT32 and exFAT filesystem (GH-112038)Miss Islington (bot)2023-11-131-3/+8
| | | | | (cherry picked from commit 29af7369dbbbba8cefafb196e977bce8189a527d) Co-authored-by: AN Long <aisk@users.noreply.github.com>
* [3.12] gh-111933: fix broken link to A.Neumaier article (gh-111937) (gh-111993)Miss Islington (bot)2023-11-121-1/+4
|
* [3.12] gh-109181: Fix refleak in tb_get_lineno() (#111948)Victor Stinner2023-11-101-1/+4
| | | PyFrame_GetCode() returns a strong reference.
* [3.12] gh-111654: remove redundant decref in LOAD_FROM_DICT_OR_DEREF ↵Jelle Zijlstra2023-11-032-281/+277
| | | | | | | (GH-111655) (#111674) (cherry picked from commit 3a1b09e6d070778d78d81084f88d37377d38ee9b) Co-authored-by: AN Long <aisk@users.noreply.github.com>
* [3.12] gh-109181: Speed up Traceback object creation by lazily compute the ↵Pablo Galindo Salgado2023-10-311-6/+29
| | | | | | line number (GH-111548) (#111551) . (cherry picked from commit abb15420c11d9dda9c89f74eac8417240b321109)
* [3.12] bpo-43950: handle wide unicode characters in tracebacks (GH-28150) ↵Pablo Galindo Salgado2023-10-261-2/+33
| | | | (#111346)
* [3.12] gh-109216: Fix possible memory leak in `BUILD_MAP` (#109324)Nikita Sobolev2023-10-152-255/+249
|
* [3.12] gh-110514: Add PY_THROW to `sys.setprofile` events (GH-110524) (#110541)Miss Islington (bot)2023-10-091-1/+7
| | | | | | gh-110514: Add PY_THROW to `sys.setprofile` events (GH-110524) (cherry picked from commit dd4bb0529e44ac6f75a9ebbfcbf5d73dc251b7a7) Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
* [3.12] gh-110237: Check `PyList_Append` for errors in `_PyEval_MatchClass` ↵Miss Islington (bot)2023-10-081-3/+11
| | | | | | | | (GH-110238) (#110511) gh-110237: Check `PyList_Append` for errors in `_PyEval_MatchClass` (GH-110238) (cherry picked from commit dd9d781da30aa3740e54c063a40413c542d78c25) Co-authored-by: denballakh <47365157+denballakh@users.noreply.github.com>
* [3.12] GH-110455: Guard `assert(tstate->thread_id > 0)` with `GH-ifndef ↵Miss Islington (bot)2023-10-061-2/+2
| | | | | | | | HAVE_PTHREAD_STUBS` (GH-110487) (GH-110491) GH-110455: Guard `assert(tstate->thread_id > 0)` with `GH-ifndef HAVE_PTHREAD_STUBS` (GH-110487) (cherry picked from commit 5fd8821cf8eb1fe2e8575f8c7cc747cf78855a88) Co-authored-by: Brett Cannon <brett@python.org>
* [3.12] gh-108987: Fix _thread.start_new_thread() race condition (#109135) ↵Victor Stinner2023-10-042-25/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | (#110342) * gh-108987: Fix _thread.start_new_thread() race condition (#109135) Fix _thread.start_new_thread() race condition. If a thread is created during Python finalization, the newly spawned thread now exits immediately instead of trying to access freed memory and lead to a crash. thread_run() calls PyEval_AcquireThread() which checks if the thread must exit. The problem was that tstate was dereferenced earlier in _PyThreadState_Bind() which leads to a crash most of the time. Move _PyThreadState_CheckConsistency() from thread_run() to _PyThreadState_Bind(). (cherry picked from commit 517cd82ea7d01b344804413ef05610934a43a241) * gh-109795: `_thread.start_new_thread`: allocate thread bootstate using raw memory allocator (#109808) (cherry picked from commit 1b8f2366b38c87b0450d9c15bdfdd4c4a2fc3a01) --------- Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com>
* [3.12] gh-110052: Fix faulthandler for freed tstate (#110069) (#110071)Victor Stinner2023-10-021-10/+37
| | | | | | | | gh-110052: Fix faulthandler for freed tstate (#110069) faulthandler now detected freed interp and freed tstate, and no longer dereference them. (cherry picked from commit 2e37a38bcbfbe1357436e030538290e7d00b668d)
* [3.12] gh-109889: fix compiler's redundant NOP detection to look past NOPs ↵Miss Islington (bot)2023-10-021-1/+11
| | | | | | | | with no lineno when looking for the next instruction's lineno (GH-109987) (#110048) gh-109889: fix compiler's redundant NOP detection to look past NOPs with no lineno when looking for the next instruction's lineno (GH-109987) (cherry picked from commit f580edcc6a4c528020afe46c753db713474acad6) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.12] gh-109521: Fix obscure cases handling in PyImport_GetImporter() ↵Miss Islington (bot)2023-10-021-5/+21
| | | | | | | | | | | | | | (GH-109522) (#109777) gh-109521: Fix obscure cases handling in PyImport_GetImporter() (GH-109522) PyImport_GetImporter() now sets RuntimeError if it fails to get sys.path_hooks or sys.path_importer_cache or they are not list and dict correspondingly. Previously it could return NULL without setting error in obscure cases, crash or raise SystemError if these attributes have wrong type. (cherry picked from commit 62c7015e89cbdedb5218d4fedd45f971885f67a8) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] Fix error handling in _PySys_UpdateConfig() (GH-109524) (#109550)Miss Islington (bot)2023-10-021-2/+9
| | | | | | Fix error handling in _PySys_UpdateConfig() (GH-109524) (cherry picked from commit c829975428253568d47ebfc3104fa7386b5e0b58) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-109351: Fix crash when compiling AST with invalid NamedExpr ↵Miss Islington (bot)2023-10-021-0/+5
| | | | | | | | (GH-109352) (#109379) gh-109351: Fix crash when compiling AST with invalid NamedExpr (GH-109352) (cherry picked from commit 79101edb03b7381b514126c68acabfcbbba2f842) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* [3.12] gh-109179: Fix traceback display for SyntaxErrors with notes ↵Irit Katriel2023-10-021-13/+11
| | | | | | (#109197) (#109280) (cherry picked from commit ecd21a629a2a30bcae89902f7cad5670e9441e2c)
* [3.12] gh-109207: Fix SystemError when printing symtable entry object. ↵Miss Islington (bot)2023-10-021-3/+2
| | | | | | | | (GH-109225) (#109227) gh-109207: Fix SystemError when printing symtable entry object. (GH-109225) (cherry picked from commit 429749969621b149c1a7c3c004bd44f52bec8f44) Co-authored-by: 云line <31395137+yunline@users.noreply.github.com>
* [3.12] Check the result of PySet_Contains() for error in Python/symtable.c ↵Miss Islington (bot)2023-10-021-15/+57
| | | | | | | | (GH-109146) (#109153) Check the result of PySet_Contains() for error in Python/symtable.c (GH-109146) (cherry picked from commit 87a7faf6b68c8076e640a9a1347a255f132d8382) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-104690: thread_run() checks for tstate dangling pointer (#109056) ↵Victor Stinner2023-10-022-18/+26
| | | | | | | | | | | | | | (#109133) gh-104690: thread_run() checks for tstate dangling pointer (#109056) thread_run() of _threadmodule.c now calls _PyThreadState_CheckConsistency() to check if tstate is a dangling pointer when Python is built in debug mode. Rename ceval_gil.c is_tstate_valid() to _PyThreadState_CheckConsistency() to reuse it in _threadmodule.c. (cherry picked from commit f63d37877ad166041489a968233b57540f8456e8)
* [3.12] gh-109889: comment out assertion indicating a failed optimization of ↵Irit Katriel2023-09-261-1/+7
| | | | | | | a redundant NOP (#109899) * [3.12] gh-109889: comment out assertion indicating a failed optimization of a redundant NOP * comment out the function to avoid warnings on it being unused
* [3.12] gh-109823: Adjust labels in compiler when removing an empty basic ↵Miss Islington (bot)2023-09-261-1/+8
| | | | | | | | block which is a jump target (GH-109839) (#109865) gh-109823: Adjust labels in compiler when removing an empty basic block which is a jump target (GH-109839) (cherry picked from commit d73c12b88c2275fd44e27c91c24f3ac85419d2b8) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.12] gh-109719: Fix missing jump target labels when compiler reorders ↵Miss Islington (bot)2023-09-241-0/+5
| | | | | | | | cold/warm blocks (GH-109734) (#109749) gh-109719: Fix missing jump target labels when compiler reorders cold/warm blocks (GH-109734) (cherry picked from commit 7c553991724d8d537f8444db73f016008753d77a) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.12] gh-109627: duplicated small exit blocks need to be assigned jump ↵Irit Katriel2023-09-221-5/+17
| | | | | | | target labels (#109630) (#109632) gh-109627: duplicated smalll exit blocks need to be assigned jump target labels (#109630) (cherry picked from commit 9ccf0545efd5bc5af5aa51774030c471d49a972b)
* [3.12] gh-109371: Fix monitoring with instruction events set (gh-109385) ↵Miss Islington (bot)2023-09-181-1/+4
| | | | | | | | (#109542) gh-109371: Fix monitoring with instruction events set (gh-109385) (cherry picked from commit 412f5e85d6b9f2e90c57c54539d06c7a025a472a) Co-authored-by: Tian Gao <gaogaotiantian@hotmail.com>
* [3.12] gh-109219: propagate free vars through type param scopes (GH-109377) ↵Miss Islington (bot)2023-09-141-3/+2
| | | | | | | | | (#109410) gh-109219: propagate free vars through type param scopes (GH-109377) (cherry picked from commit 909adb5092c0ae9426814742d97932204b211cfb) Co-authored-by: Carl Meyer <carl@oddbird.net> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* [3.12] gh-105658: fix excess trace events for except block ending with a ↵Irit Katriel2023-09-141-14/+2
| | | | | | | conditional block (#109384) (#109411) gh-105658: fix excess trace events for except block ending with a conditional block (#109384) (cherry picked from commit 4a54074a0f5579d417445ec28427cd0ed5aa01f4)
* [3.12] gh-109341: Fix crash on compiling invalid AST including TypeAlias ↵Miss Islington (bot)2023-09-141-0/+5
| | | | | | | | (GH-109349) (#109381) gh-109341: Fix crash on compiling invalid AST including TypeAlias (GH-109349) (cherry picked from commit 987b4bc0870e1e29a88275dc3fa39bf2c3dcc763) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* [3.12] gh-109118: Disallow nested scopes within PEP 695 scopes within ↵Miss Islington (bot)2023-09-121-0/+23
| | | | | | | | | | | | classes (GH-109196) (#109297) gh-109118: Disallow nested scopes within PEP 695 scopes within classes (GH-109196) Fixes GH-109118. Fixes GH-109194. (cherry picked from commit b88d9e75f68f102aca45fa62e2b0e2e2ff46d810) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Carl Meyer <carl@oddbird.net>
* [3.12] gh-109195: fix source location for super load before LOAD_SUPER_ATTR ↵Miss Islington (bot)2023-09-121-1/+1
| | | | | | | | (GH-109289) (#109291) gh-109195: fix source location for super load before LOAD_SUPER_ATTR (GH-109289) (cherry picked from commit ceeb4173aee7b835f553a8286feaa48b98c16124) Co-authored-by: Carl Meyer <carl@oddbird.net>
* [3.12] GH-108976. Keep monitoring data structures valid during ↵Mark Shannon2023-09-121-55/+49
| | | | | de-optimization during callback. (GH-109131) (#109268) GH-108976. Keep monitoring data structures valid during de-optimization during callback. (GH-109131)
* [3.12] gh-109118: Fix runtime crash when NameError happens in PEP 695 ↵Jelle Zijlstra2023-09-123-430/+459
| | | | | | | | | | | | function (GH-109123) (#109173) * gh-109118: Fix runtime crash when NameError happens in PEP 695 function (#109123) (cherry picked from commit 17f994174de9211b2baaff217eeb1033343230fc) * [3.12] gh-109118: Fix runtime crash when NameError happens in PEP 695 function (GH-109123). (cherry picked from commit 17f994174de9211b2baaff217eeb1033343230fc) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
* [3.12] gh-106922: Fix error location for constructs with spaces and ↵Miss Islington (bot)2023-09-081-0/+17
| | | | | | parentheses (GH-108959) (#109147) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.12] GH-108390: Prevent non-local events being set with ↵Mark Shannon2023-09-052-65/+114
| | | | | | | | | | | `sys.monitoring.set_local_events()` (GH-108420) (#108899) * GH-108390: Prevent non-local events being set with `sys.monitoring.set_local_events()` (GH-108420) * Restore generated objects * Restore size of monitoring arrays in code object for 3.12 ABI compatibility. * Update ABI file
* [3.12] gh-108654: restore comprehension locals before handling exception ↵Miss Islington (bot)2023-08-311-14/+53
| | | | | | | | | (GH-108659) (#108700) gh-108654: restore comprehension locals before handling exception (GH-108659) (cherry picked from commit d52c4482a82f3f98f1a78efa948144a1fe3c52b2) Co-authored-by: Carl Meyer <carl@oddbird.net> Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>