summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* [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>
* [3.12] gh-107913: Fix possible losses of OSError error codes (GH-107930) ↵Miss Islington (bot)2023-08-261-1/+3
| | | | | | | | | | | | (#108523) gh-107913: Fix possible losses of OSError error codes (GH-107930) Functions like PyErr_SetFromErrno() and SetFromWindowsErr() should be called immediately after using the C API which sets errno or the Windows error code. (cherry picked from commit 2b15536fa94d07e9e286826c23507402313ec7f4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-108487: Change assert that should've been DEOPT_IF (#108509)Guido van Rossum2023-08-262-2/+2
| | | | | | | | | | | | | | | | | | | | | * Remove assert that should've been DEOPT_IF The assert(method != NULL) in CALL_NO_KW_LIST_APPEND is wrong -- this condition should lead to a deoptimization, and indeed there is a DEOPT_IF two lines later that will trigger if method == NULL. This would crash in a devious repro scenario (first seen live in boto3 tests) when compiled with assertions enabled. In a production version there is no crash, so impact is limited. (The crash also appears in main; I will prepare a separate PR.) * Add back a different assert(self != NULL) * 📜🤖 Added by blurb_it. --------- Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* [3.12] gh-107901: Fix missing line number on BACKWARD_JUMP at the end of a ↵Miss Islington (bot)2023-08-221-1/+1
| | | | | | | | for loop (GH-108242) (#108275) gh-107901: Fix missing line number on BACKWARD_JUMP at the end of a for loop (GH-108242) (cherry picked from commit a1cc74c4eebc55795877eb3be019a1bec34402f8) Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
* [3.12] gh-107916: Save the error code before decoding the filename in ↵Miss Islington (bot)2023-08-211-0/+8
| | | | | | | | PyErr_SetFromErrnoWithFilename() etc (GH-107929) (#108205) gh-107916: Save the error code before decoding the filename in PyErr_SetFromErrnoWithFilename() etc (GH-107929) (cherry picked from commit 80bdebdd8593f007a2232ec04a7729bba6ebf12c) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-107915: Handle errors in C API functions PyErr_Set*() and ↵Miss Islington (bot)2023-08-201-8/+29
| | | | | | | | | | | | | | | | | | | | PyErr_Format() (GH-107918) (#108134) * gh-107915: Handle errors in C API functions PyErr_Set*() and PyErr_Format() (GH-107918) Such C API functions as PyErr_SetString(), PyErr_Format(), PyErr_SetFromErrnoWithFilename() and many others no longer crash or ignore errors if it failed to format the error message or decode the filename. Instead, they keep a corresponding error. (cherry picked from commit 633ea217a85f6b6ba5bdbc73094254d5811b3485) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> * Define PY_SSIZE_T_CLEAN. --------- Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-106242: Fix path truncation in os.path.normpath (GH-106816) (#107981)Steve Dower2023-08-161-8/+21
| | | | | | | | | * gh-106242: Fix path truncation in os.path.normpath (GH-106816) * gh-106242: Minor fixup to avoid compiler warnings --------- Co-authored-by: Finn Womack <flan313@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters ↵Eric Snow2023-08-162-4/+7
| | | | | | | | | | | (#107751) * Unrevert "[3.12] gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters (gh-107567) (#107599)". This reverts commit 6e4eec760648a71e1cd8f8f551997b1823b4bb9f (gh-107648). * Initialize each interpreter's refchain properly. * Skip test_basic_multiple_interpreters_deleted_no_reset on tracerefs builds.
* [3.12] GH-107774: Add missing audit event for PEP 669 (GH-107775) (#107839)Miss Islington (bot)2023-08-111-0/+3
| | | | | | GH-107774: Add missing audit event for PEP 669 (GH-107775) (cherry picked from commit 494e3d4436774a5ac1a569a635b8c5c881ef1c0c) Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.12] GH-107724: Fix the signature of `PY_THROW` callback functions. ↵Miss Islington (bot)2023-08-113-14/+4
| | | | | | | | (GH-107725) (#107802) GH-107724: Fix the signature of `PY_THROW` callback functions. (GH-107725) (cherry picked from commit 52fbcf61b5a70993c2d32332ff0ad9f369d968d3) Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.12] gh-107630: Revert "[3.12] gh-107080: Fix Py_TRACE_REFS Crashes Under ↵Eric Snow2023-08-051-4/+4
| | | | | | | Isolated Subinterpreters (gh-107567) (#107599)" (#107648) Revert "[3.12] gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters (gh-107567) (#107599)" This reverts commit 58af2293c52a1ad3754d254690c0e54f787c545b.
* [3.12] GH-107263: Increase C stack limit for most functions, except ↵Miss Islington (bot)2023-08-047-15/+14
| | | | | | | | | | `_PyEval_EvalFrameDefault()` (GH-107535) (#107618) GH-107263: Increase C stack limit for most functions, except `_PyEval_EvalFrameDefault()` (GH-107535) * Set C recursion limit to 1500, set cost of eval loop to 2 frames, and compiler mutliply to 2. (cherry picked from commit fa45958450aa3489607daf9855ca0474a2a20878) Co-authored-by: Mark Shannon <mark@hotpy.org>
* [3.12] gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters ↵Miss Islington (bot)2023-08-031-4/+4
| | | | | | | | | | (gh-107567) (#107599) gh-107080: Fix Py_TRACE_REFS Crashes Under Isolated Subinterpreters (gh-107567) The linked list of objects was a global variable, which broke isolation between interpreters, causing crashes. To solve this, we've moved the linked list to each interpreter. (cherry picked from commit 58ef74186795c56e3ec86e8c8f351a1d7826638a) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-107471: Fix Refleaks in test_import (gh-107569) (#107571)Miss Islington (bot)2023-08-021-0/+1
| | | | | | | | | | | | gh-107471: Fix Refleaks in test_import (gh-107569) gh-107184 introduced a refleak in test_import.SubinterpImportTests (specifically test_singlephase_check_with_setting_and_override and test_single_init_extension_compat). We fix it here by making sure _testsinglephase is removed from sys.modules whenever we clear the runtime's internal state for the module. The underlying problem is strictly contained in the internal function _PyImport_ClearExtension() (AKA _testinternalcapi.clear_extension()), which is only used in tests. (This also fixes an intermittent segfault introduced in the same place, in test_disallowed_reimport.) (cherry picked from commit 017f047183fa33743f7e36c5c360f5c670032be3) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache ↵Eric Snow2023-07-282-171/+122
| | | | | | | | | | | | | (gh-106974) (gh-107412) gh-105699: Use a _Py_hashtable_t for the PyModuleDef Cache (gh-106974) This fixes a crasher due to a race condition, triggered infrequently when two isolated (own GIL) subinterpreters simultaneously initialize their sys or builtins modules. The crash happened due the combination of the "detached" thread state we were using and the "last holder" logic we use for the GIL. It turns out it's tricky to use the same thread state for different threads. Who could have guessed? We solve the problem by eliminating the one object we were still sharing between interpreters. We replace it with a low-level hashtable, using the "raw" allocator to avoid tying it to the main interpreter. We also remove the accommodations for "detached" thread states, which were a dubious idea to start with. (cherry picked from commit 8ba4df91ae60833723d8d3b9afeb2b642f7176d5)
* [3.12] GH-106898: Add the exception as an argument to the `PY_UNWIND` event ↵Mark Shannon2023-07-282-3/+23
| | | | callback function. (GH-107347) (GH-107382)
* [3.12] GH-106895: Raise a `ValueError` when attempting to disable events ↵Mark Shannon2023-07-284-142/+150
| | | | that cannot be disabled. (GH-107337) (GH-107351)
* [3.12] GH-106897: Add `RERAISE` event to `sys.monitoring`. (GH-107291) ↵Mark Shannon2023-07-284-382/+409
| | | | | | (GH-107346) * Ensures that exception handling events are balanced. Each [re]raise event has a matching unwind/handled event.
* [3.12] gh-104621: Check for Incompatible Extensions in ↵Miss Islington (bot)2023-07-271-10/+11
| | | | | | | | | | import_find_extension() (gh-107184) (gh-107360) gh-104621: Check for Incompatible Extensions in import_find_extension() (gh-107184) This fixes a bug where incompatible modules could still be imported if attempted multiple times. (cherry picked from commit 75c974f5353685f338344618ad7344e64c2293d0) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-106917: fix super classmethod calls to non-classmethods ↵Carl Meyer2023-07-242-2/+2
| | | | | (GH-106977). (#107204) (cherry picked from commit e5d5522612e03af3941db1d270bf6caebf330b8a)
* [3.12] GH-103082: Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS ↵Victor Stinner2023-07-223-24/+24
| | | | | | | | | | | | (#107069) (#107075) GH-103082: Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS (#107069) Rename private C API constants: * Rename PY_MONITORING_UNGROUPED_EVENTS to _PY_MONITORING_UNGROUPED_EVENTS * Rename PY_MONITORING_EVENTS to _PY_MONITORING_EVENTS (cherry picked from commit 0927a2b25c059988e237108605ed8ab0c5459c53)
* [3.12] gh-86493: Fix possible leaks in some modules initialization ↵Serhiy Storchaka2023-07-181-19/+10
| | | | | | (GH-106768) (GH-106855) Fix _ssl, _stat, _testinternalcapi, _threadmodule, cmath, math, posix, time. (cherry picked from commit 3e65baee72131b49f4ce8ca2da568a6f2001ce93)
* [3.12] gh-101538: Add experimental wasi-threads build (GH-101537) (#106834)Miss Islington (bot)2023-07-171-0/+8
| | | | | | | (cherry picked from commit d8f87cdf94a6533c5cf2d25e09e6fa3eb06720b9) Co-authored-by: YAMAMOTO Takashi <yamamoto@midokura.com> Co-authored-by: Brett Cannon <brett@python.org> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
* [3.12] gh-105340: include hidden fast-locals in locals() (GH-105715) (#106470)Miss Islington (bot)2023-07-052-34/+66
| | | | | | | | gh-105340: include hidden fast-locals in locals() (GH-105715) * gh-105340: include hidden fast-locals in locals() (cherry picked from commit 104d7b760fed18055e4f04e5da3ca619e28bfc81) Co-authored-by: Carl Meyer <carl@oddbird.net>
* [3.12] Document PYTHONSAFEPATH along side -P (GH-106122) (#106352)Miss Islington (bot)2023-07-051-2/+2
| | | | | | Document PYTHONSAFEPATH along side -P (GH-106122) (cherry picked from commit 0355625d94a50f4b816770bad946420d005900b8) Co-authored-by: Jeremy Paige <ucodery@gmail.com>
* [3.12] gh-106145: Make `end_{lineno,col_offset}` required on `type_param` ↵Miss Islington (bot)2023-07-011-12/+6
| | | | | | | | nodes (GH-106224) (#106295) gh-106145: Make `end_{lineno,col_offset}` required on `type_param` nodes (GH-106224) (cherry picked from commit 46c1097868745eeb47abbc8af8c34e8fcb80ff1d) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-101006: Improve error handling when read marshal data (GH-101007) ↵Miss Islington (bot)2023-06-291-61/+71
| | | | | | | | | | | | (GH-106226) * EOFError no longer overrides other errors such as MemoryError or OSError at the start of the object. * Raise more relevant error when the NULL object occurs as a code object component. * Minimize an overhead of calling PyErr_Occurred(). (cherry picked from commit 8bf6904b229583033035d91a3800da5604dcaad4) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-106118: Add O_CLOEXEC preprocessor guard (GH-106120) (#106199)Miss Islington (bot)2023-06-281-1/+4
| | | | | (cherry picked from commit 6c60684bf5d34fae27a2f6a142ff794b38cefe1b) Co-authored-by: Erlend E. Aasland <erlend@python.org>
* [3.12] gh-106030: Miscellaneous fixes in Python/suggestions.c (GH-106031) ↵Miss Islington (bot)2023-06-271-15/+27
| | | | | | (#106036) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-105979: Fix exception handling in `unmarshal_frozen_code` ↵Miss Islington (bot)2023-06-261-0/+1
| | | | | | | | (`Python/import.c`) (GH-105980) (#106055) gh-105979: Fix exception handling in `unmarshal_frozen_code` (`Python/import.c`) (GH-105980) (cherry picked from commit cd5280367a3a7065d13b8f7234474f7a2e9a18fd) Co-authored-by: chgnrdv <52372310+chgnrdv@users.noreply.github.com>
* [3.12] gh-106033: Get rid of new occurrences of PyDict_GetItem and Py… ↵Serhiy Storchaka2023-06-241-7/+5
| | | | | | | | | | (#106041) [3.12] gh-106033: Get rid of new occurrences of PyDict_GetItem and PyObject_HasAttr (GH-106034) These functions are broken by design because they discard any exceptions raised inside, including MemoryError and KeyboardInterrupt. They should not be used in new code. (cherry picked from commit 1d33d5378058671bfabb6f4d4b5bfd4726973ff9)
* [3.12] gh-105908: fix `barry_as_FLUFL` future import (GH-105909) (#105930)Miss Islington (bot)2023-06-201-6/+10
| | | | | (cherry picked from commit 28187a9c4f95affe50fd37e0db0db177e2b9c2e9) Co-authored-by: Crowthebird <78076854+thatbirdguythatuknownot@users.noreply.github.com>
* [3.12] GH-105840: Fix assertion failures when specializing calls with too ↵Miss Islington (bot)2023-06-161-2/+2
| | | | | | | | many __defaults__ (GH-105863) GH-105840: Fix assertion failures when specializing calls with too many __defaults__ (GH-105847) (cherry picked from commit 2beab5bdef5fa2a00a59371e6137f769586b7404) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* [3.12] GH-105588: Add missing error checks to some obj2ast_* converters ↵Miss Islington (bot)2023-06-151-0/+7
| | | | | | | | (GH-105838) GH-105588: Add missing error checks to some obj2ast_* converters (GH-105589) (cherry picked from commit a4056c8f9c2d9970d39e3cb6bffb255cd4b8a42c) Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
* [3.12] gh-105699: Use a Thread-Local Variable for PKGCONTEXT (gh-105740) ↵Miss Islington (bot)2023-06-141-0/+15
| | | | | | | | (gh-105765) This fixes a race during import. The existing _PyRuntimeState.imports.pkgcontext is shared between interpreters, and occasionally this would cause a crash when multiple interpreters were importing extensions modules at the same time. To solve this we add a thread-local variable for the value. We also leave the existing state (and infrequent race) in place for platforms that do not support thread-local variables. (cherry picked from commit b87d2882754a7c273e2695c33384383eba380d7d) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-104812: Run Pending Calls in any Thread (gh-104813) (gh-105752)Eric Snow2023-06-144-83/+191
| | | | For a while now, pending calls only run in the main thread (in the main interpreter). This PR changes things to allow any thread run a pending call, unless the pending call was explicitly added for the main thread to run. (cherry picked from commit 757b402)