summaryrefslogtreecommitdiffstats
path: root/Include
Commit message (Collapse)AuthorAgeFilesLines
* Python 3.12.9v3.12.9Thomas Wouters2025-02-041-2/+2
|
* [3.12] gh-128679: Fix tracemalloc.stop() race conditions (#128897) (#129022)Victor Stinner2025-01-191-1/+1
| | | | | | | | | | | | | | | | | [3.13] gh-128679: Fix tracemalloc.stop() race conditions (#128897) tracemalloc_alloc(), tracemalloc_realloc(), PyTraceMalloc_Track(), PyTraceMalloc_Untrack() and _PyTraceMalloc_TraceRef() now check tracemalloc_config.tracing after calling TABLES_LOCK(). _PyTraceMalloc_Stop() now protects more code with TABLES_LOCK(), especially setting tracemalloc_config.tracing to 1. Add a test using PyTraceMalloc_Track() to test tracemalloc.stop() race condition. Call _PyTraceMalloc_Init() at Python startup. (cherry picked from commit 6b47499510e47c0401d1f6cca2660fc12c496e39)
* [3.12] gh-127599: Fix _Py_RefcntAdd missing calls to ↵Ed Nutting2025-01-181-0/+5
| | | | | | | | | _Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC (GH-127717) (#128712) Previously, `_Py_RefcntAdd` hasn't called `_Py_INCREF_STAT_INC/_Py_INCREF_IMMORTAL_STAT_INC` which is incorrect. Now it has been fixed. (cherry picked from commit ab05beb8cea62636bd86f6f7cf1a82d7efca7162)
* [3.12] gh-126742: Add _PyErr_SetLocaleString, use it for gdbm & dlerror ↵Bénédikt Tran2024-12-171-0/+12
| | | | | | | | | messages (GH-126746) (GH-128027) - Add a helper to set an error from locale-encoded `char*` - Use the helper for gdbm & dlerror messages Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-127906: Declare timeval struct in pytime.h on Windows (#127908)Victor Stinner2024-12-131-1/+1
| | | | | | | | gh-127906: Declare timeval struct in pytime.h on Windows Fix the following MSVC compiler warning: include\cpython\pytime.h(192): warning C4115: 'timeval': named type definition in parentheses
* [3.12] gh-107249: Implement Py_UNUSED() for MSVC (GH-107250) (#127907)Miss Islington (bot)2024-12-131-0/+9
| | | | | | | | | | | | | | | | | | | | | | gh-107249: Implement Py_UNUSED() for MSVC (GH-107250) Fix warnings C4100 in Py_UNUSED() when Python is built with "cl /W4". Example with this function included by Python.h: static inline unsigned int PyUnicode_IS_READY(PyObject* Py_UNUSED(op)) { return 1; } Without this change, building a C program with "cl /W4" which just includes Python.h emits the warning: Include\cpython/unicodeobject.h(199): warning C4100: '_unused_op': unreferenced formal parameter This change fix this warning. (cherry picked from commit 6a43cce32b66e0f66992119dd82959069b6f324a) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] gh-127902: Make sure `extern "C"` is closed when using Py_LIMITED_API ↵Dmitry Shachnev2024-12-131-1/+1
| | | | | (#127904) Fixes #127902.
* [3.12] Add `extern "C"` around `PyTraceMalloc_` functions. (#127772) (#127817)Victor Stinner2024-12-111-1/+6
| | | | | | | | | | Add `extern "C"` around `PyTraceMalloc_` functions. (#127772) Pretty much everything else exported by Python.h has an extern "C" annotation, yet this header appears to be missing one. (cherry picked from commit 2cdeb61b57e638ae46a04386330a12abe9cddf2c) Co-authored-by: Peter Hawkins <hawkinsp@cs.stanford.edu>
* Post 3.12.8Thomas Wouters2024-12-031-1/+1
|
* Python 3.12.8v3.12.8Thomas Wouters2024-12-031-2/+2
|
* [3.12] gh-116510: Fix a Crash Due to Shared Immortal Interned Strings ↵Miss Islington (bot)2024-12-032-8/+7
| | | | | | | | | | | | | | | | (gh-125205) Fix a crash caused by immortal interned strings being shared between sub-interpreters that use basic single-phase init. In that case, the string can be used by an interpreter that outlives the interpreter that created and interned it. For interpreters that share obmalloc state, also share the interned dict with the main interpreter. This is an un-revert of gh-124646 that then addresses the Py_TRACE_REFS failures identified by gh-124785 (i.e. backporting gh-125709 too). (cherry picked from commit f2cb39947093feda3ff85b8dc820922cc5e5f954, AKA gh-124865) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* [3.12] gh-127208: Reject null character in _imp.create_dynamic() (#127400) ↵Victor Stinner2024-11-291-0/+3
| | | | | | | | | | | | (#127419) gh-127208: Reject null character in _imp.create_dynamic() (#127400) _imp.create_dynamic() now rejects embedded null characters in the path and in the module name. Backport also the _PyUnicode_AsUTF8NoNUL() function. (cherry picked from commit b14fdadc6c620875a20b7ccc3c9b069e85d8557a)
* [3.12] gh-126303: Fix pickling and copying of os.sched_param objects ↵Serhiy Storchaka2024-11-051-0/+2
| | | | | (GH-126336) (GH-126424) (cherry picked from commit d3840503b0f590ee574fbdf3c96626ff8b3c45f6)
* Post 3.12.7Thomas Wouters2024-10-011-1/+1
|
* Python 3.12.7v3.12.7Thomas Wouters2024-10-011-2/+2
|
* [3.12] gh-113993: Make interned strings mortal (GH-120520, GH-121364, ↵Petr Viktorin2024-09-276-763/+1478
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GH-121903, GH-122303) (#123065) This backports several PRs for gh-113993, making interned strings mortal so they can be garbage-collected when no longer needed. * Allow interned strings to be mortal, and fix related issues (GH-120520) * Add an InternalDocs file describing how interning should work and how to use it. * Add internal functions to *explicitly* request what kind of interning is done: - `_PyUnicode_InternMortal` - `_PyUnicode_InternImmortal` - `_PyUnicode_InternStatic` * Switch uses of `PyUnicode_InternInPlace` to those. * Disallow using `_Py_SetImmortal` on strings directly. You should use `_PyUnicode_InternImmortal` instead: - Strings should be interned before immortalization, otherwise you're possibly interning a immortalizing copy. - `_Py_SetImmortal` doesn't handle the `SSTATE_INTERNED_MORTAL` to `SSTATE_INTERNED_IMMORTAL` update, and those flags can't be changed in backports, as they are now part of public API and version-specific ABI. * Add private `_only_immortal` argument for `sys.getunicodeinternedsize`, used in refleak test machinery. Make sure the statically allocated string singletons are unique. This means these sets are now disjoint: - `_Py_ID` - `_Py_STR` (including the empty string) - one-character latin-1 singletons Now, when you intern a singleton, that exact singleton will be interned. * Add a `_Py_LATIN1_CHR` macro, use it instead of `_Py_ID`/`_Py_STR` for one-character latin-1 singletons everywhere (including Clinic). * Intern `_Py_STR` singletons at startup. * Beef up the tests. Cover internal details (marked with `@cpython_only`). * Add lots of assertions * Don't immortalize in PyUnicode_InternInPlace; keep immortalizing in other API (GH-121364) * Switch PyUnicode_InternInPlace to _PyUnicode_InternMortal, clarify docs * Document immortality in some functions that take `const char *` This is PyUnicode_InternFromString; PyDict_SetItemString, PyObject_SetAttrString; PyObject_DelAttrString; PyUnicode_InternFromString; and the PyModule_Add convenience functions. Always point out a non-immortalizing alternative. * Don't immortalize user-provided attr names in _ctypes * Immortalize names in code objects to avoid crash (GH-121903) * Intern latin-1 one-byte strings at startup (GH-122303) There are some 3.12-specific changes, mainly to allow statically allocated strings in deepfreeze. (In 3.13, deepfreeze switched to the general `_Py_ID`/`_Py_STR`.) Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
* Post 3.12.6Thomas Wouters2024-09-061-1/+1
|
* Python 3.12.6v3.12.6Thomas Wouters2024-09-061-2/+2
|
* Post 3.12.5Thomas Wouters2024-08-071-1/+1
|
* Python 3.12.5v3.12.5Thomas Wouters2024-08-061-2/+2
|
* [3.12] gh-118124: fix assert related C++ checks on Solaris/Illumos ↵Jakub Kulík2024-07-221-4/+4
| | | | | | (GH-121974) (#122109) Fix check for static_assert() for C++ on some platforms.. (cherry picked from commit e88bd96d0d6cf8218c4fca37e1d20399ae676a04)
* [3.12] gh-121905: Consistently use "floating-point" instead of "floating ↵Serhiy Storchaka2024-07-191-1/+1
| | | | | point" (GH-121907) (GH-122013) (cherry picked from commit 1a0c7b9ba48a2dffb70bb0c7327abae1d3e87356)
* [3.12] gh-119447: Fix build with _PY_SHORT_FLOAT_REPR == 0 (#121178) (#121180)Victor Stinner2024-06-301-7/+3
| | | | | | | gh-119447: Fix build with _PY_SHORT_FLOAT_REPR == 0 (#121178) (cherry picked from commit c3677befbecbd7fa94cde8c1fecaa4cc18e6aa2b) Co-authored-by: Yureka <yuka@yuka.dev>
* [3.12] Fix typos in comments (GH-120481) (#120775)Terry Jan Reedy2024-06-201-1/+1
| | | | | | | Only 1 applicable change backported to 3.12. (cherry picked from commit 656a1c8) Co-authored-by: Xie Yanbo xieyanbo@gmail.com
* [3.12] gh-119897: Revert buggy optimization which was removed in 3.13 (#120467)Irit Katriel2024-06-181-3/+0
|
* Post 3.12.4Thomas Wouters2024-06-061-1/+1
|
* Python 3.12.4v3.12.4Thomas Wouters2024-06-061-2/+2
|
* [3.12] gh-119311: Fix name mangling with PEP 695 generic classes (#119464) ↵Jelle Zijlstra2024-06-041-0/+2
| | | | | | | | | | (#119644) * [3.12] gh-119311: Fix name mangling with PEP 695 generic classes (#119464) Fixes #119311. Fixes #119395. (cherry picked from commit a9a74da4a0ca0645f049e67b6434a95e30592c32)
* [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
|