cpython/Python
Eric Snow 0d5fe2c7b4
[3.12] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across 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 81865002ae)
2024-05-22 22:26:58 +00:00
..
clinic [3.12] gh-105069: Add a readline-like callable to the tokenizer to consume input iteratively (GH-105070) (#105119) 2023-05-31 11:11:53 +01:00
deepfreeze
frozen_modules
_warnings.c [3.12] gh-105375: Improve PyErr_WarnExplicit() error handling (GH-105610) (#105659) 2023-06-11 19:51:30 +00:00
adaptive.md
asdl.c
asm_trampoline.S
assemble.c gh-87092: avoid gcc warning on uninitialized struct field in assemble.c (#104460) 2023-05-14 12:03:30 +01:00
ast.c [3.12] GH-112215: Backport C recursion changes (GH-115083) 2024-02-13 10:45:59 +01:00
ast_opt.c [3.12] GH-112215: Backport C recursion changes (GH-115083) 2024-02-13 10:45:59 +01:00
ast_unparse.c gh-100227: Move _str_replace_inf to PyInterpreterState (gh-102333) 2023-02-28 14:16:39 -07:00
bltinmodule.c [3.12] gh-111933: fix broken link to A.Neumaier article (gh-111937) (gh-111993) 2023-11-12 01:22:44 +00:00
bootstrap_hash.c
bytecodes.c [3.12] gh-116735: Use MISSING for CALL event if argument is absen… (#116873) 2024-03-19 17:00:54 +00:00
ceval.c [3.12] gh-112716: Fix SystemError when __builtins__ is not a dict (GH-112770) (GH-113103) 2023-12-14 12:54:25 +00:00
ceval_gil.c [3.12] gh-108987: Fix _thread.start_new_thread() race condition (#109135) (#110342) 2023-10-04 11:20:31 +00:00
ceval_macros.h GH-104580: Don't cache eval breaker in interpreter (GH-104581) 2023-05-18 10:08:33 +01:00
codecs.c gh-77757: replace exception wrapping by PEP-678 notes in typeobject's __set_name__ (#103402) 2023-04-11 11:53:06 +01:00
compile.c [3.12] gh-118513: Fix sibling comprehensions with a name bound in one and global in the other (GH-118526) (#118548) 2024-05-03 14:40:05 +00:00
condvar.h
context.c gh-94673: Hide Objects in PyTypeObject Behind Accessors (gh-104074) 2023-05-01 20:34:43 -06:00
dtoa.c [3.12] gh-91565: Replace bugs.python.org links with Devguide/GitHub ones (GH-91568) (GH-117890) 2024-04-15 12:59:34 +00:00
dup2.c
dynamic_annotations.c
dynload_hpux.c
dynload_shlib.c gh-101758: Clean Up Uses of Import State (gh-101919) 2023-02-15 15:32:31 -07:00
dynload_stub.c
dynload_win.c gh-102255: Improve build support for Windows API partitions (GH-102256) 2023-03-09 21:09:12 +00:00
emscripten_signal.c
errors.c [3.12] gh-107916: Save the error code before decoding the filename in PyErr_SetFromErrnoWithFilename() etc (GH-107929) (#108205) 2023-08-21 14:33:46 +02:00
fileutils.c gh-111856: Fix os.fstat on windows with FAT32 and exFAT filesystem (GH-112038) 2023-11-13 16:25:01 +00:00
flowgraph.c [3.12] gh-113297: Fix segfault in compiler for with statement with 19 context managers (#113327) (#113404) 2023-12-23 13:29:11 +00:00
formatter_unicode.c
frame.c [3.12] gh-118272: Clear generator frame's locals when the generator is closed (#118451) 2024-05-02 16:22:50 +01:00
frozen.c [3.12] gh-106560: Fix redundant declarations in Python/frozen.c (#112612) (#112651) 2023-12-03 11:54:59 +00:00
frozenmain.c
future.c
generated_cases.c.h [3.12] gh-116735: Use MISSING for CALL event if argument is absen… (#116873) 2024-03-19 17:00:54 +00:00
getargs.c [3.12] gh-119213: Be More Careful About _PyArg_Parser.kwtuple Across Interpreters (gh-119331) (gh-119425) 2024-05-22 22:26:58 +00:00
getcompiler.c
getcopyright.c
getopt.c
getplatform.c
getversion.c
hamt.c
hashtable.c [3.12] gh-106931: Intern Statically Allocated Strings Globally (gh-107272) (gh-110713) 2023-11-27 23:51:12 +00:00
import.c [3.12] gh-114685: Fix incorrect use of PyBUF_READ in import.c (GH-114686) (GH-114700) 2024-01-29 10:09:51 +00:00
importdl.c gh-98627: Add an Optional Check for Extension Module Subinterpreter Compatibility (gh-99040) 2023-02-15 18:16:00 -07:00
importdl.h
initconfig.c [3.12] gh-90300: Remove reference to PYTHON_FROZEN_MODULES in Python CLI help (GH-117035) 2024-03-19 20:05:08 +00:00
instrumentation.c [3.12] gh-109371: Fix monitoring with instruction events set (gh-109385) (#109542) 2023-09-18 17:40:51 +02:00
intrinsics.c gh-103763: Implement PEP 695 (#103764) 2023-05-15 20:36:23 -07:00
legacy_tracing.c [3.12] gh-110514: Add PY_THROW to sys.setprofile events (GH-110524) (#110541) 2023-10-09 09:11:51 +00:00
makeopcodetargets.py gh-98040: Remove just the imp module (#98573) 2023-04-28 16:17:58 -07:00
marshal.c [3.12] gh-101006: Improve error handling when read marshal data (GH-101007) (GH-106226) 2023-06-29 13:46:51 +03:00
modsupport.c [3.12] gh-86493: Fix possible leaks in some modules initialization (GH-106768) (GH-106855) 2023-07-18 15:14:10 +03:00
mysnprintf.c
mystrtoul.c
opcode_metadata.h [3.12] gh-109118: Fix runtime crash when NameError happens in PEP 695 function (GH-109123) (#109173) 2023-09-12 15:59:09 +02:00
opcode_targets.h gh-103865: add monitoring support to LOAD_SUPER_ATTR (#103866) 2023-05-16 10:29:00 -06:00
pathconfig.c
perf_trampoline.c [3.12] gh-113343: Fix error check on mmap(2) (GH-113342) (#113374) 2023-12-21 19:44:15 +00:00
preconfig.c
pyarena.c
pyctype.c
pyfpe.c
pyhash.c
pylifecycle.c [3.12] gh-112367: Only free perf trampoline arenas at shutdown (GH-112368) (#112590) 2023-12-01 16:05:31 +00:00
pymath.c
pystate.c [3.12] gh-110310: Add a Per-Interpreter XID Registry for Heap Types (gh-110311) (gh-110714) 2023-11-28 02:36:29 +00:00
pystrcmp.c
pystrhex.c
pystrtod.c gh-104263: Rely on Py_NAN and introduce Py_INFINITY (GH-104202) 2023-05-10 17:44:52 +01:00
Python-ast.c [3.12] GH-112215: Backport C recursion changes (GH-115083) 2024-02-13 10:45:59 +01:00
Python-tokenize.c [3.12] gh-112943: Correctly compute end offsets for multiline tokens in the tokenize module (GH-112949) (#112957) 2023-12-11 12:48:19 +00:00
pythonrun.c [3.12] gh-113358: Fix rendering tracebacks with exceptions with a broken __getattr__ (GH-113359) (#114173) 2024-01-21 17:12:17 +00:00
pytime.c gh-97786: Fix compiler warnings in pytime.c (#101826) 2023-02-19 17:16:11 -08:00
README
specialize.c [3.12] Check for valid tp_version_tag in specializer (gh-89811) (gh-114216) 2024-01-20 04:45:33 +08:00
stdlib_module_names.h GH-84976: Move Lib/datetime.py to Lib/_pydatetime 2023-05-03 03:09:45 -06:00
structmember.c [3.12] gh-115011: Improve support of __index__() in setters of members with unsigned integer type (GH-115029) (GH-115294) 2024-02-11 11:56:17 +00:00
suggestions.c [3.12] gh-106030: Miscellaneous fixes in Python/suggestions.c (GH-106031) (#106036) 2023-06-26 20:43:20 -07:00
symtable.c [3.12] gh-96497: Mangle name before symtable lookup in 'symtable_extend_namedexpr_scope' (GH-96561) (GH-115603) 2024-02-17 14:49:39 +02:00
sysmodule.c [3.12] gh-116326: Handler errors correctly in getwindowsversion in sysmodule (GH-116339) (#116354) 2024-03-05 18:52:15 +03:00
thread.c gh-94673: Properly Initialize and Finalize Static Builtin Types for Each Interpreter (gh-104072) 2023-05-01 19:36:00 -06:00
thread_nt.h
thread_pthread.h [3.12] gh-112536: Add TSAN build on Github Actions (GH-116872) 2024-03-18 09:52:54 +00:00
thread_pthread_stubs.h
traceback.c [3.12] gh-109181: Fix refleak in tb_get_lineno() (#111948) 2023-11-10 14:07:45 +01:00
tracemalloc.c GH-101520: Move tracemalloc functionality into core, leaving interface in Modules. (#104508) 2023-05-17 14:17:16 +01:00

Miscellaneous source files for the main Python shared library