summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-106905: Use separate structs to track recursion depth in each ↵Serhiy Storchaka2023-12-251-2/+2
| | | | | | | | | 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-1/+1
| | | | context managers (#113327) (#113404)
* [3.12] gh-112867: fix for WITH_PYMALLOC_RADIX_TREE=0 (GH-112885) (#113068)Miss Islington (bot)2023-12-131-0/+2
| | | | | | | | | gh-112867: fix for WITH_PYMALLOC_RADIX_TREE=0 (GH-112885) The _obmalloc_usage structure is only defined if the obmalloc radix tree is enabled. (cherry picked from commit 890ce430d94b0b2bccc92a8472b1e1030b4faeb8) Co-authored-by: Neil Schemenauer <nas-github@arctrix.com>
* [3.12] gh-110820: Disable test_signal.test_stress_modifying_handlers on ↵Ronald Oussoren2023-12-091-1/+10
| | | | | | | | | | macOS (GH-112834) * gh-110820: Make sure processor specific defines are correct for Universal 2 build on macOS (#112828) A number of processor specific defines are different for x86-64 and arm64, and need to be adjusted in pymacconfig.h. (cherry picked from commit 15a80b15af9a0b0ebe6bd538a1919712ce7d4ef9)
* Post 3.12.1Thomas Wouters2023-12-081-1/+1
|
* Python 3.12.1v3.12.1Thomas Wouters2023-12-071-2/+2
|
* [3.12] gh-112125: Fix None.__ne__(None) returning NotImplemented instead of ↵Victor Stinner2023-12-071-0/+2
| | | | | | | | | … (#112827) gh-112125: Fix None.__ne__(None) returning NotImplemented instead of False (#112504) (cherry picked from commit 9c3458e05865093dd55d7608810a9d0ef0765978) Co-authored-by: andrewluotechnologies <44252973+andrewluotechnologies@users.noreply.github.com>
* [3.12] gh-106550: Fix sign conversion in pycore_code.h (GH-112613) (#112696)Miss Islington (bot)2023-12-041-10/+12
| | | | | | | | | gh-106550: Fix sign conversion in pycore_code.h (GH-112613) Fix sign conversion in pycore_code.h: use unsigned integers and cast explicitly when needed. (cherry picked from commit a74902a14cdc0952abf7bfabcf529c9b132c5cce) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-106560: Fix redundant declarations in Include/ (#112611) (#112650)Victor Stinner2023-12-032-2/+2
| | | | | | | gh-106560: Fix redundant declarations in Include/ (#112611) Don't declare PyBool_Type and PyLong_Type twice, but only once. Compiler warnings seen by building Python with gcc -Wredundant-decls.
* [3.12] gh-112367: Only free perf trampoline arenas at shutdown (GH-112368) ↵Pablo Galindo Salgado2023-12-011-0/+1
| | | | | | | (#112590) (cherry picked from commit a73aa48e6bec900be7edd3431deaa5fc1d809e6f) Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
* [3.12] gh-111058: Change coro.cr_frame/gen.gi_frame to be None for a closed ↵Miss Islington (bot)2023-12-011-0/+2
| | | | coroutine/generator. (GH-112428) (#112589)
* [3.12] gh-111698: Restrict Py_mod_multiple_interpreters to 3.12+ Under ↵Miss Islington (bot)2023-11-281-1/+3
| | | | | | | | | | Py_LIMITED_API (gh-111707) (gh-111787) This should have been done in gh-104148. (A similar fix has already be done for that slot's value macros, and backported to 3.12. See gh-110968.) (cherry picked from commit 836e0a75d565ecb7e2485fee88dbe67e649a1d5f) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-109894: Fix initialization of static `MemoryError` in ↵Miss Islington (bot)2023-11-281-0/+1
| | | | | | | | | | | | | | | subinterpreter (gh-110911) (gh-111238) Fixes GH-109894 * set `interp.static_objects.last_resort_memory_error.args` to empty tuple to avoid crash on `PyErr_Display()` call * allow `_PyExc_InitGlobalObjects()` to be called on subinterpreter init --------- (cherry picked from commit 47d3e2ed930a9f3d228aed4f62133737dae74cf7) Co-authored-by: Radislav Chugunov <52372310+chgnrdv@users.noreply.github.com> Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* [3.12] gh-110310: Add a Per-Interpreter XID Registry for Heap Types ↵Eric Snow2023-11-282-19/+29
| | | | | | | | | | | | | | | (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-282-0/+7
| | | | | | | | | (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-283-2/+41
| | | | | (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-275-1/+12
| | | | | | | | | (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-271-0/+5
| | | | | | | 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-0/+2
| | | | | | (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-110968: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED was added to 3.12 ↵Victor Stinner2023-11-011-5/+7
| | | | | | (#111588) Constants like Py_MOD_PER_INTERPRETER_GIL_SUPPORTED were only added to the limited C API version 3.12 and newer.
* [3.12] gh-107450: Check for overflow in the tokenizer and fix overflow test ↵Lysandros Nikolaou2023-10-161-19/+19
| | | | | | | | | (GH-110832) (#110931) (cherry picked from commit a1ac5590e0f8fe008e5562d22edab65d0c1c5507) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Filipe Laíns <lains@riseup.net> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-108987: Fix _thread.start_new_thread() race condition (#109135) ↵Victor Stinner2023-10-041-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | (#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-109596: Ensure repeated rules in the grammar are not allowed and ↵Pablo Galindo Salgado2023-10-021-3/+0
| | | | | fix incorrect soft keywords (GH-109606). (#109752) (cherry picked from commit b28ffaa193efc66f46ab90d383279174a11a11d7)
* [3.12] gh-104690: thread_run() checks for tstate dangling pointer (#109056) ↵Victor Stinner2023-10-021-0/+4
| | | | | | | | | | | | | | (#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)
* Post 3.12.0Thomas Wouters2023-10-021-1/+1
|
* Python 3.12.0v3.12.0Thomas Wouters2023-10-021-3/+3
|
* Post 3.12.0rc3Thomas Wouters2023-09-191-1/+1
|
* Python 3.12.0rc3v3.12.0rc3Thomas Wouters2023-09-181-2/+2
|
* [3.12] gh-109496: Detect Py_DECREF() after dealloc in debug mode (GH-109539) ↵Miss Islington (bot)2023-09-181-6/+4
| | | | | | | | | | | | | | | | | (#109545) gh-109496: Detect Py_DECREF() after dealloc in debug mode (GH-109539) On a Python built in debug mode, Py_DECREF() now calls _Py_NegativeRefcount() if the object is a dangling pointer to deallocated memory: memory filled with 0xDD "dead byte" by the debug hook on memory allocators. The fix is to check the reference count *before* checking for _Py_IsImmortal(). Add test_decref_freed_object() to test_capi.test_misc. (cherry picked from commit 0bb0d88e2d4e300946e399e088e2ff60de2ccf8c) Co-authored-by: Victor Stinner <vstinner@python.org>
* Post 3.12.0rc2Thomas Wouters2023-09-061-1/+1
|
* Python 3.12.0rc2v3.12.0rc2Thomas Wouters2023-09-051-2/+2
|
* [3.12] GH-108390: Prevent non-local events being set with ↵Mark Shannon2023-09-053-8/+15
| | | | | | | | | | | `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-63760: Don't declare gethostname() on Solaris (#108817) (#108824)Victor Stinner2023-09-021-5/+0
| | | | | | | | | | | | | | | | gh-63760: Don't declare gethostname() on Solaris (#108817) Since 2005, Solaris defines gethostname(). socketmodule.c no longer has to define gethostname() for Solaris. Oracle Solaris and OpenSolaris have patches to remove the gethostname() definition in Python: * https://github.com/oracle/solaris-userland/blob/master/components/python/python37/patches/15-gethostname.patch * https://github.com/OpenIndiana/oi-userland/blob/oi/hipster/components/python/python37/patches/15-gethostname.patch * https://github.com/omniosorg/omnios-build/blob/master/build/python27/patches/24-gethostname.patch Co-authored-by: Jakub Kulík <Kulikjak@gmail.com> (cherry picked from commit 0e6d582b3b73a88e71cae04327b31a1ee203722c)
* [3.12] gh-106242: Fix path truncation in os.path.normpath (GH-106816) (#107981)Steve Dower2023-08-161-1/+2
| | | | | | | | | * 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-163-6/+23
| | | | | | | | | | | (#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-91051: fix segfault when using all 8 type watchers (GH-107853) ↵Miss Islington (bot)2023-08-161-1/+1
| | | | | | | | (#107876) * gh-91051: fix segfault when using all 8 type watchers (GH-107853) (cherry picked from commit 66e4edd7346b1cd65ddff6da890a0d725e325116) Co-authored-by: Carl Meyer <carl@oddbird.net>
* [3.12] GH-107724: Fix the signature of `PY_THROW` callback functions. ↵Miss Islington (bot)2023-08-111-4/+0
| | | | | | | | (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>
* Post 3.12.0rc1Thomas Wouters2023-08-061-1/+1
|
* Python 3.12.0rc1v3.12.0rc1Thomas Wouters2023-08-051-3/+3
|
* [3.12] gh-107630: Revert "[3.12] gh-107080: Fix Py_TRACE_REFS Crashes Under ↵Eric Snow2023-08-053-22/+6
| | | | | | | 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-041-1/+2
| | | | | | | | | | `_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-033-6/+22
| | | | | | | | | | (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-105699: Use a _Py_hashtable_t for the PyModuleDef Cache ↵Eric Snow2023-07-283-17/+6
| | | | | | | | | | | | | (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-106895: Raise a `ValueError` when attempting to disable events ↵Mark Shannon2023-07-281-1/+2
| | | | that cannot be disabled. (GH-107337) (GH-107351)
* [3.12] GH-106897: Add `RERAISE` event to `sys.monitoring`. (GH-107291) ↵Mark Shannon2023-07-282-4/+5
| | | | | | (GH-107346) * Ensures that exception handling events are balanced. Each [re]raise event has a matching unwind/handled event.
* [3.12] gh-101524: Only Use Public C-API in the _xxsubinterpreters Module ↵Miss Islington (bot)2023-07-273-15/+21
| | | | | | | | (gh-105258) (gh-107303) The _xxsubinterpreters module was meant to only use public API. Some internal C-API usage snuck in over the last few years (e.g. gh-28969). This fixes that. (cherry picked from commit e6373c0d8b59512aa7f0dea7f3fb162b6ed10fa4) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-107226: PyModule_AddObjectRef() should only be in the limited API ↵Miss Islington (bot)2023-07-251-0/+2
| | | | | | | 3.10 (GH-107227) (GH-107260) (cherry picked from commit 698b01513550798886add5e06a1c3f9a89d7dfc6) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-105059: Fix MSCV compiler warning on PyObject union (GH-107239) ↵Miss Islington (bot)2023-07-251-0/+11
| | | | | | | | | | | (#107248) gh-105059: Fix MSCV compiler warning on PyObject union (GH-107239) Use pragma to ignore the MSCV compiler warning on the PyObject nameless union. (cherry picked from commit 1c8fe9bdb624d356643ee569151a9e4f2963179a) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-105059: Use GCC/clang extension for PyObject union (GH-107232) ↵Miss Islington (bot)2023-07-251-0/+5
| | | | | | | | | | | | (#107236) gh-105059: Use GCC/clang extension for PyObject union (GH-107232) Anonymous union is new in C11. To prevent compiler warning when using -pedantic compiler option, use Clang and GCC extension on C99 and older. (cherry picked from commit 6261585d63a31835b65d445d99dc14cca3fe9cf5) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-102304: Rename _Py_IncRefTotal_DO_NOT_USE_THIS() (GH-107193) (#107199)Miss Islington (bot)2023-07-241-9/+4
| | | | | | | | | | gh-102304: Rename _Py_IncRefTotal_DO_NOT_USE_THIS() (GH-107193) * Rename _Py_IncRefTotal_DO_NOT_USE_THIS() to _Py_INCREF_IncRefTotal() * Rename _Py_DecRefTotal_DO_NOT_USE_THIS() to _Py_DECREF_DecRefTotal() * Remove temporary _Py_INC_REFTOTAL() and _Py_DEC_REFTOTAL() macros (cherry picked from commit 8ebc9fc321ba1eeb3282c2170f351c54956893e6) Co-authored-by: Victor Stinner <vstinner@python.org>