summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across ↵Eric Snow2024-05-224-0/+6
| | | | | | | | | | | Interpreters (gh-119331) (gh-119425) _PyArg_Parser holds static global data generated for modules by Argument Clinic. The _PyArg_Parser.kwtuple field is a tuple object, even though it's stored within a static global. In some cases the tuple is statically allocated and thus it's okay that it gets shared by multiple interpreters. However, in other cases the tuple is set lazily, allocated from the heap using the active interprepreter at the point the tuple is needed. This is a problem once that interpreter is destroyed since _PyArg_Parser.kwtuple becomes at dangling pointer, leading to crashes. It isn't a problem if the tuple is allocated under the main interpreter, since its lifetime is bound to the lifetime of the runtime. The solution here is to temporarily switch to the main interpreter. The alternative would be to always statically allocate the tuple. This change also fixes a bug where only the most recent parser was added to the global linked list. (cherry picked from commit 81865002aee8eaaeb3c7e402f86183afa6de77bf)
* [3.12] gh-118997: Fix _Py_ClearImmortal() assertion (#119001)Victor Stinner2024-05-181-1/+1
| | | | | | Fix _Py_ClearImmortal() assertion: use _Py_IsImmortal() to tolerate reference count lower than _Py_IMMORTAL_REFCNT. Fix the assertion for the stable ABI, when a C extension is built with Python 3.11 or lower.
* [3.12] gh-118272: Clear generator frame's locals when the generator is ↵Irit Katriel2024-05-021-0/+3
| | | | closed (#118451)
* [3.12] gh-116767: fix crash on 'async with' with many context managers ↵Irit Katriel2024-05-011-1/+1
| | | | | | | | | | | | (GH-118348) (#118477) gh-116767: fix crash on 'async with' with many context managers (GH-118348) Account for `add_stopiteration_handler` pushing a block for `async with`. To allow generator functions that previously almost hit the `CO_MAXBLOCKS` limit by nesting non-async blocks, the limit is increased by 1. This increase allows one more block in non-generator functions. (cherry picked from commit c1bf4874c1e9db2beda1d62c8c241229783c789b)
* [3.12] gh-118207: Rename the COMMON_FIELDS macro in funcobject.h and undef ↵Miss Islington (bot)2024-04-261-3/+5
| | | | | | | | it after use (GH-118208) (#118269) gh-118207: Rename the COMMON_FIELDS macro in funcobject.h and undef it after use (GH-118208) (cherry picked from commit 796b3fb28057948ea5b98f7eb0c0f3af6a1e276e) Co-authored-by: Itamar Oren <itamarost@gmail.com>
* [3.12] gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled ↵Miss Islington (bot)2024-04-101-0/+3
| | | | | | | | | | | | (GH-117702) (#117713) gh-112536: Define `_Py_THREAD_SANITIZER` on GCC when TSan is enabled (GH-117702) The `__has_feature(thread_sanitizer)` is a Clang-ism. Although new versions of GCC implement `__has_feature`, the `defined(__has_feature)` check still fails on GCC so we don't use that code path. (cherry picked from commit 79eec66e3dc277ea6ebad8c0b33756eea6a7ab3b) Co-authored-by: Sam Gross <colesbury@gmail.com>
* Post 3.12.3Thomas Wouters2024-04-091-1/+1
|
* Python 3.12.3v3.12.3Thomas Wouters2024-04-091-2/+2
|
* [3.12] gh-117021: Fix integer overflow in PyLong_AsPid() on non-Windows ↵Serhiy Storchaka2024-03-202-4/+21
| | | | | 64-bit platforms (GH-117064) (GH-117070) (cherry picked from commit 519b2ae22b54760475bbf62b9558d453c703f9c6)
* [3.12] gh-116869: Make C API compatible with ISO C90 (GH-116950) (#117011)Miss Islington (bot)2024-03-192-3/+3
| | | | | | | | | gh-116869: Make C API compatible with ISO C90 (GH-116950) Make the C API compatible with -Werror=declaration-after-statement compiler flag again. (cherry picked from commit a9c304cf020e2fa3ae78fd88359dfc808c9dd639) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-112536: Add support for thread sanitizer (TSAN) (gh-112648) (#116924)Antoine Pitrou2024-03-171-0/+5
| | | | | | | | | | * [3.12] gh-112536: Add support for thread sanitizer (TSAN) (gh-112648) (cherry picked from commit 88cb9720001295f82c7771ab4ebf20f3cd0b31fb) * Remove doc for configure option (leave it hidden in this branch) --------- Co-authored-by: Samet YASLAN <sametyaslan@gmail.com>
* [3.12] gh-115398: Expose Expat >=2.6.0 reparse deferral API (CVE-2023-52425) ↵Sebastian Pipping2024-03-061-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | (GH-115623) (GH-116248) Allow controlling Expat >=2.6.0 reparse deferral (CVE-2023-52425) by adding five new methods: - `xml.etree.ElementTree.XMLParser.flush` - `xml.etree.ElementTree.XMLPullParser.flush` - `xml.parsers.expat.xmlparser.GetReparseDeferralEnabled` - `xml.parsers.expat.xmlparser.SetReparseDeferralEnabled` - `xml.sax.expatreader.ExpatParser.flush` Based on the "flush" idea from https://github.com/python/cpython/pull/115138#issuecomment-1932444270 . - Please treat as a security fix related to CVE-2023-52425. (cherry picked from commit 6a95676bb526261434dd068d6c49927c44d24a9b) (cherry picked from commit 73807eb634315f70a464a18feaae33d9e065de09) (cherry picked from commit eda2963378a3c292cf6bb202bb00e94e46ee6d90) --------- Includes code suggested-by: Snild Dolkow <snild@sony.com> and by core dev Serhiy Storchaka. Co-authored-by: Gregory P. Smith <greg@krypto.org>
* [3.12] chore: fix typos (#116345) (#116370)Terry Jan Reedy2024-03-052-2/+2
| | | | Co-authored-by: cui fliter <imcusg@gmail.com> (cherry picked from commit e7ba6e9dbe5433b4a0bcb0658da6a68197c28630)
* [3.12] GH-112215: Backport C recursion changes (GH-115083)Mark Shannon2024-02-131-4/+16
|
* [3.12] gh-114828: parenthesize non-atomic macro definitions in ↵Miss Islington (bot)2024-02-071-12/+12
| | | | | | | | pycore_symtable.h (GH-115143) (#115149) gh-114828: parenthesize non-atomic macro definitions in pycore_symtable.h (GH-115143) (cherry picked from commit 8f0998e844c2fd8c0c94681d0a6331c34ee31562) Co-authored-by: Carl Meyer <carl@oddbird.net>
* Post 3.12.2Thomas Wouters2024-02-061-1/+1
|
* Python 3.12.2v3.12.2Thomas Wouters2024-02-061-2/+2
|
* [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)