summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-119311: Fix name mangling with PEP 695 generic classes (#119464) ↵Jelle Zijlstra2024-06-042-13/+48
| | | | | | | | | | (#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-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021) (#120023)Victor Stinner2024-06-041-5/+7
| | | | | | | | gh-111499: Fix PYTHONMALLOCSTATS at Python exit (#120021) Call _PyObject_DebugMallocStats() earlier in Py_FinalizeEx(), before the interpreter is deleted. (cherry picked from commit 5a1205b641df133932ed4c65b9a4ff5724e89963)
* [3.12] gh-119821: Fix refleak in LOAD_FROM_DICT_OR_GLOBALS (#119975)Jelle Zijlstra2024-06-032-291/+295
|
* [3.12] gh-119821: Support non-dict globals in LOAD_FROM_DICT_OR_GLOBALS ↵Jelle Zijlstra2024-06-012-329/+341
| | | | | | | | | | | (#119822) (#119890) The implementation basically copies LOAD_GLOBAL. Possibly it could be deduplicated, but that seems like it may get hairy since the two operations have different operands. This is important to fix in 3.14 for PEP 649, but it's a bug in earlier versions too, and we should backport to 3.13 and 3.12 if possible. (cherry picked from commit 80a4e3899420faaa012c82b4e82cdb6675a6a944)
* [3.12] gh-119585: Fix crash involving `PyGILState_Release()` and ↵Sam Gross2024-05-311-0/+6
| | | | | | | | | | | `PyThreadState_Clear()` (GH-119753) (#119861) Make sure that `gilstate_counter` is not zero in when calling `PyThreadState_Clear()`. A destructor called from `PyThreadState_Clear()` may call back into `PyGILState_Ensure()` and `PyGILState_Release()`. If `gilstate_counter` is zero, it will try to create a new thread state before the current active thread state is destroyed, leading to an assertion failure or crash. (cherry picked from commit bcc1be39cb1d04ad9fc0bd1b9193d3972835a57c)
* [3.12] gh-119704: Fix reference leak in the ``Python/Python-tokenize.c`` ↵Miss Islington (bot)2024-05-291-0/+1
| | | | (GH-119705) (#119708)
* [3.12] gh-119118: Fix performance regression in tokenize module (GH-119615) ↵Miss Islington (bot)2024-05-281-4/+40
| | | | | | | | | | | | | (#119683) - Cache line object to avoid creating a Unicode object for all of the tokens in the same line. - Speed up byte offset to column offset conversion by using the smallest buffer possible to measure the difference. (cherry picked from commit d87b0151062e36e67f9e42e1595fba5bf23a485c) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* [3.12] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across ↵Eric Snow2024-05-221-0/+17
| | | | | | | | | | | 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-118513: Fix sibling comprehensions with a name bound in one and ↵Miss Islington (bot)2024-05-031-39/+42
| | | | | | | | | | global in the other (GH-118526) (#118548) gh-118513: Fix sibling comprehensions with a name bound in one and global in the other (GH-118526) (cherry picked from commit c8deb1e4b495bf97ab00c710dfd63f227e1fb645) Co-authored-by: Carl Meyer <carl@oddbird.net> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru>
* [3.12] gh-118272: Clear generator frame's locals when the generator is ↵Irit Katriel2024-05-021-5/+13
| | | | closed (#118451)
* [3.12] gh-116767: fix crash on 'async with' with many context managers ↵Irit Katriel2024-05-011-2/+16
| | | | | | | | | | | | (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-91565: Replace bugs.python.org links with Devguide/GitHub ones ↵Miss Islington (bot)2024-04-151-1/+1
| | | | | | | | | | | | | (GH-91568) (GH-117890) gh-91565: Replace bugs.python.org links with Devguide/GitHub ones (GH-91568) (cherry picked from commit 3de09cadde788065a4f2d45117e789c9353bbd12) Co-authored-by: Steve (Gadget) Barnes <gadgetsteve@hotmail.com> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com> Co-authored-by: Oleg Iarygin <oleg@arhadthedev.net> Co-authored-by: Petr Viktorin <encukou@gmail.com> Co-authored-by: Ezio Melotti <ezio.melotti@gmail.com>
* [3.12] gh-90300: Remove reference to PYTHON_FROZEN_MODULES in Python CLI ↵Serhiy Storchaka2024-03-191-2/+1
| | | | | help (GH-117035) Fix error introduced in 4be9fa896117bf07dc944a29c98dd18b71dd6c74.
* [3.12] gh-90300: Improve the Python CLI help output (GH-115853) (GH-117022)Serhiy Storchaka2024-03-191-67/+38
| | | | | | | | | | | * document equivalent command-line options for all environment variables * document equivalent environment variables for all command-line options * reduce the size of variable and option descriptions to minimum * remove the ending period in single-sentence descriptions (cherry picked from commit b85572c47dc7a8c65fc366a87a3660fc7a3ed244) Co-authored-by: Éric <merwok@netwok.org> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
* [3.12] gh-116735: Use `MISSING` for `CALL` event if argument is absen… ↵Tian Gao2024-03-192-2/+2
| | | | | (#116873) [3.12] gh-116735: Use `MISSING` for `CALL` event if argument is absent (GH-116737)
* [3.12] gh-112536: Add TSAN build on Github Actions (GH-116872)Antoine Pitrou2024-03-181-0/+4
| | | | | (cherry picked from commit 20578a1f68c841a264b72b00591b11ab2fa77b43) Co-authored-by: Donghee Na <donghee.na@python.org>
* [3.12] gh-116626: Emit `CALL` events for all `INSTRUMENTED_CALL_FUNCTION_EX ↵Tian Gao2024-03-142-28/+28
| | | | | (GH-116732) Backport of GH-116627
* [3.12] gh-90300: Fix undocumented envvars in the Python CLI help (GH-116765) ↵Serhiy Storchaka2024-03-141-0/+3
| | | | | (GH-116797) (cherry picked from commit 19ac28bd08fdb16795e6f82ea7bfac73e8f3791b)
* [3.12] gh-90300: Document equivalent -X options for envvars in the Python ↵Serhiy Storchaka2024-03-141-18/+19
| | | | | CLI help (GH-116756) (GH-116786) (cherry picked from commit 8c6db45ce34df7081d7497e638daf3e130303295)
* [3.12] gh-90300: Sort the -X options and some envvars in the Python CLI help ↵Serhiy Storchaka2024-03-131-27/+28
| | | | | (GH-116739) (GH-116766) (cherry picked from commit e54bdeab9ce2958a22ba08c1f1f1431c5e8056bd)
* [3.12] gh-90300: Fix cmdline.rst (GH-116721) (GH-116724)Miss Islington (bot)2024-03-131-2/+2
| | | | | | | * Fix the description of the "-b" option. * Add references to environment variables for "-s" and "-X dev" options. (cherry picked from commit 33662d4e01d73cd4f29a25efc2ef09288129023f) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-116447: Fix possible UB in `arraymodule` and `getargs` (GH-116459) ↵Miss Islington (bot)2024-03-081-2/+2
| | | | | | | | (#116496) gh-116447: Fix possible UB in `arraymodule` and `getargs` (GH-116459) (cherry picked from commit fdb2d90a274158aee23b526d972172bf41bd4b7e) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-116326: Handler errors correctly in `getwindowsversion` in ↵Miss Islington (bot)2024-03-051-18/+32
| | | | | | | | `sysmodule` (GH-116339) (#116354) * gh-116326: Handler errors correctly in `getwindowsversion` in `sysmodule` (GH-116339) (cherry picked from commit c91bdf86ef1cf9365b61a46aa2e51e5d1932b00a) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow ↵Miss Islington (bot)2024-03-041-23/+25
| | | | | | | | errors (GH-115321) (#116323) gh-115320: Refactor `get_hash_info` in `sysmodule.c` not to swallow errors (GH-115321) (cherry picked from commit 207030f5527d405940b79c10c1413c1e8ff696c1) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-116034: fix location info on the error of a failed assertion (#116054)Irit Katriel2024-02-291-1/+1
|
* [3.12] gh-90300: Reformat the Python CLI help output (GH-93415) (#115847)Łukasz Langa2024-02-231-95/+95
| | | | | (cherry picked from commit 2e92ffd7fa89e3bd33ee2f31541d3dc53aaa2d12) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.12] gh-96497: Mangle name before symtable lookup in ↵Miss Islington (bot)2024-02-171-4/+10
| | | | | | | 'symtable_extend_namedexpr_scope' (GH-96561) (GH-115603) (cherry picked from commit 664965a1c141e8af5eb465d29099781a6a2fc3f3) Co-authored-by: wookie184 <wookie1840@gmail.com>
* [3.12] GH-112215: Backport C recursion changes (GH-115083)Mark Shannon2024-02-134-20/+8
|
* [3.12] gh-115011: Improve support of __index__() in setters of members with ↵Serhiy Storchaka2024-02-111-37/+45
| | | | | | | | | | | | | | unsigned integer type (GH-115029) (GH-115294) Setters for members with an unsigned integer type now support the same range of valid values for objects that has a __index__() method as for int. Previously, Py_T_UINT, Py_T_ULONG and Py_T_ULLONG did not support objects that has a __index__() method larger than LONG_MAX. Py_T_ULLONG did not support negative ints. Now it supports them and emits a RuntimeWarning. (cherry picked from commit d9d6909697501a2604d5895f9f88aeec61274ab0)
* [3.12] gh-114828: Fix __class__ in class-scope inlined comprehensions ↵Miss Islington (bot)2024-02-071-0/+19
| | | | | | | | (GH-115139) (#115140) gh-114828: Fix __class__ in class-scope inlined comprehensions (GH-115139) (cherry picked from commit fedbf77191ea9d6515b39f958cc9e588d23517c9) Co-authored-by: Carl Meyer <carl@oddbird.net>
* [3.12] gh-114388: Fix warnings when assign an unsigned integer member ↵Serhiy Storchaka2024-02-041-28/+57
| | | | | | | | | | (GH-114391) (GH-115001) * Fix a RuntimeWarning emitted when assign an integer-like value that is not an instance of int to an attribute that corresponds to a C struct member of type T_UINT and T_ULONG. * Fix a double RuntimeWarning emitted when assign a negative integer value to an attribute that corresponds to a C struct member of type T_UINT. (cherry picked from commit 3ddc5152550ea62280124c37d0b4339030ff7df4)
* [3.12] gh-114685: Fix incorrect use of PyBUF_READ in import.c (GH-114686) ↵Miss Islington (bot)2024-01-291-1/+1
| | | | | | | (GH-114700) (cherry picked from commit 1ac1b2f9536a581f1656f0ac9330a7382420cda1) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] gh-113358: Fix rendering tracebacks with exceptions with a broken ↵Jérome Perrin2024-01-211-1/+32
| | | | __getattr__ (GH-113359) (#114173)
* [3.12] gh-114384: Align sys.set_asyncgen_hooks signature in docs to reflect ↵Miss Islington (bot)2024-01-211-1/+1
| | | | | | | implementation (GH-114385) (#114386) (cherry picked from commit 38768e4cdd1c4b6e03702da8a94e1c22479d6ed3) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* [3.12] Check for valid tp_version_tag in specializer (gh-89811) (gh-114216)Peter Lazorchak2024-01-191-0/+22
|
* [3.12] gh-113842: Add missing error check for PyIter_Next() in ↵Miss Islington (bot)2024-01-091-0/+6
| | | | | | | Python/symtable.c (GH-113843) (GH-113851) (cherry picked from commit fda901a1ff94ea6cc338b74928acdbc5ee165ed7) Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
* [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)