cpython/Python
Eric Snow 132b3f8302
gh-59956: Partial Fix for GILState API Compatibility with Subinterpreters (gh-101431)
The GILState API (PEP 311) implementation from 2003 made the assumption that only one thread state would ever be used for any given OS thread, explicitly disregarding the case of subinterpreters.  However, PyThreadState_Swap() still facilitated switching between subinterpreters, meaning the "current" thread state (holding the GIL), and the GILState thread state could end up out of sync, causing problems (including crashes).

This change addresses the issue by keeping the two in sync in PyThreadState_Swap().  I verified the fix against gh-99040.

Note that the other GILState-subinterpreter incompatibility (with autoInterpreterState) is not resolved here.

https://github.com/python/cpython/issues/59956
2023-02-06 14:39:25 -07:00
..
clinic gh-39615: Add warnings.warn() skip_file_prefixes support (#100840) 2023-01-27 18:35:14 -08:00
deepfreeze gh-97669: Create Tools/build/ directory (#97963) 2022-10-17 12:01:00 +02:00
frozen_modules gh-97669: Create Tools/build/ directory (#97963) 2022-10-17 12:01:00 +02:00
_warnings.c gh-39615: fix warning on return type mismatch (#101407) 2023-01-29 16:41:27 -08:00
adaptive.md GH-98686: Get rid of "adaptive" and "quick" instructions (GH-99182) 2022-11-09 10:50:09 -08:00
asdl.c bpo-43244: Remove ast.h, asdl.h, Python-ast.h headers (GH-24933) 2021-03-23 20:47:40 +01:00
asm_trampoline.S gh-96143: Move the perf trampoline files to the Python directory (#98675) 2022-10-25 23:34:22 +01:00
ast.c GH-91079: Decouple C stack overflow checks from Python recursion checks. (GH-96510) 2022-10-05 01:34:03 +01:00
ast_opt.c gh-99300: Use Py_NewRef() in Python/ directory (#99302) 2022-11-10 09:03:39 +01:00
ast_unparse.c gh-81057: Move Global Variables Holding Objects to _PyRuntimeState. (gh-99487) 2022-11-14 13:50:56 -07:00
bltinmodule.c GH-101291: Refactor the PyLongObject struct into object header and PyLongValue struct. (GH-101292) 2023-01-30 10:03:04 +00:00
bootstrap_hash.c gh-81057: Move More Globals in Core Code to _PyRuntimeState (gh-99516) 2022-11-16 09:37:14 -07:00
bytecodes.c gh-98831: rewrite MAKE_FUNCTION and BUILD_SLICE in the instruction definition DSL (#101529) 2023-02-03 14:40:45 +00:00
ceval.c Fix some comments in ceval.c and fix lltrace output (#101297) 2023-01-24 14:58:18 -08:00
ceval_gil.c gh-59956: Clarify Runtime State Status Expectations (gh-101308) 2023-01-30 12:07:48 -07:00
ceval_macros.h GH-98831: Move assorted macros from ceval.h to a new header (#101116) 2023-01-18 10:41:07 -08:00
codecs.c gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530) 2022-11-16 18:34:24 +01:00
compile.c gh-98831: rewrite PUSH_EXC_INFO and conditional jumps in the instruction definition DSL (#101481) 2023-02-01 19:38:06 +00:00
condvar.h gh-74953: _PyThread_cond_after() uses _PyTime_t (#94056) 2022-06-21 15:45:49 +02:00
context.c gh-81057: Move contextvars-related Globals to _PyRuntimeState (gh-99400) 2022-11-16 09:54:28 -07:00
dtoa.c gh-81057: Move More Globals to _PyRuntimeState (gh-100092) 2022-12-07 15:56:31 -07:00
dup2.c gh-95174: Handle missing dup() and constants in WASI (GH-95229) 2022-07-26 11:16:51 +02:00
dynamic_annotations.c bpo-32241: Add the const qualifire to declarations of umodifiable strings. (#4748) 2017-12-12 13:55:04 +02:00
dynload_hpux.c bpo-44959: Add fallback to extension modules with '.sl' suffix on HP-UX (GH-27857) 2021-09-08 14:43:00 +02:00
dynload_shlib.c bpo-43895: Remove an unnecessary cache of shared object handles (GH-25487) 2021-07-07 16:26:06 -07:00
dynload_stub.c
dynload_win.c gh-92536: PEP 623: Remove wstr and legacy APIs from Unicode (GH-92537) 2022-05-12 14:48:38 +09:00
emscripten_signal.c bpo-47176: Interrupt handling for wasm32-emscripten builds without pthreads (GH-32209) 2022-04-03 22:58:52 +02:00
errors.c gh-99537: Use Py_SETREF(var, NULL) in C code (#99687) 2022-11-23 14:57:50 +01:00
fileutils.c gh-81057: Move More Globals in Core Code to _PyRuntimeState (gh-99516) 2022-11-16 09:37:14 -07:00
formatter_unicode.c gh-89653: Use int type for Unicode kind (#92704) 2022-05-13 12:41:05 +02:00
frame.c GH-100126: Skip incomplete frames in more places (GH-100613) 2023-01-09 12:20:04 -08:00
frozen.c gh-97669: Create Tools/build/ directory (#97963) 2022-10-17 12:01:00 +02:00
frozenmain.c gh-93103: Parser uses PyConfig.parser_debug instead of Py_DebugFlag (#93106) 2022-05-24 22:35:08 +02:00
future.c gh-87092: do not allocate PyFutureFeatures dynamically (GH-98913) 2022-11-02 15:13:07 +00:00
generated_cases.c.h gh-98831: rewrite MAKE_FUNCTION and BUILD_SLICE in the instruction definition DSL (#101529) 2023-02-03 14:40:45 +00:00
getargs.c gh-99240: Reset pointer to NULL when the pointed memory is freed in argument parsing (#99890) 2022-12-17 12:07:44 +05:30
getcompiler.c closes bpo-43278: remove unnecessary leading '\n' from COMPILER when build with GCC/Clang (GH-24606) 2021-02-25 20:24:21 -08:00
getcopyright.c Update copyright years to 2023. (gh-100848) 2023-01-08 09:13:25 -06:00
getopt.c gh-90300: split --help output into separate options (#30331) 2022-06-01 05:50:01 -04:00
getplatform.c bpo-32150: Expand tabs to spaces in C files. (#4583) 2017-11-28 17:56:10 +02:00
getversion.c gh-81057: Move Globals in Core Code to _PyRuntimeState (gh-99496) 2022-11-15 09:45:11 -07:00
hamt.c gh-99537: Use Py_SETREF() function in C code (#99657) 2022-11-22 13:39:11 +01:00
hashtable.c bpo-41061: Fix incorrect expressions in hashtable (GH-21028) 2020-06-22 00:41:48 -07:00
import.c gh-99578: Fix refleak in _imp.create_builtin() (#99642) 2022-11-21 12:14:54 +01:00
importdl.c gh-99947: Ensure unreported errors are chained for SystemError during import (GH-99946) 2022-12-23 15:43:19 -08:00
importdl.h bpo-47162: Add call trampoline to mitigate bad fpcasts on Emscripten (GH-32189) 2022-03-30 12:28:33 -07:00
importlib.h bpo-38693: Use f-strings instead of str.format() within importlib (#17058) 2022-10-06 16:43:16 -07:00
initconfig.c gh-95778: add doc missing in some places (GH-100627) 2022-12-30 13:21:15 -08:00
intrinsics.c GH-99005: More intrinsics (GH-100774) 2023-01-06 14:47:57 +00:00
makeopcodetargets.py gh-94216: add pseudo instructions to the dis/opcodes modules (GH-94241) 2022-07-01 15:33:35 +01:00
marshal.c GH-101291: Refactor the PyLongObject struct into object header and PyLongValue struct. (GH-101292) 2023-01-30 10:03:04 +00:00
modsupport.c gh-81057: Move More Globals in Core Code to _PyRuntimeState (gh-99516) 2022-11-16 09:37:14 -07:00
mysnprintf.c Add a warning message about PyOS_snprintf (#95993) 2022-10-07 11:49:53 -07:00
mystrtoul.c bpo-35134: Add Include/cpython/longobject.h (GH-29044) 2021-10-19 02:04:52 +02:00
opcode_metadata.h gh-98831: rewrite MAKE_FUNCTION and BUILD_SLICE in the instruction definition DSL (#101529) 2023-02-03 14:40:45 +00:00
opcode_targets.h GH-100982: Add COMPARE_AND_BRANCH instruction (GH-100983) 2023-01-16 12:35:21 +00:00
pathconfig.c gh-98978: Fix Py_SetPythonHome(NULL) (#99066) 2022-11-03 18:34:32 +01:00
perf_trampoline.c gh-81057: Move Ceval Trampoline Globals to _PyRuntimeState (gh-100083) 2022-12-08 17:17:20 -07:00
preconfig.c gh-77782: Deprecate global configuration variable (#93943) 2022-06-17 16:12:00 +02:00
pyarena.c bpo-43244: Remove the pyarena.h header (GH-25007) 2021-03-24 02:23:01 +01:00
pyctype.c
pyfpe.c bpo-46315: Add ifdef HAVE_ feature checks for WASI compatibility (GH-30507) 2022-01-13 09:46:04 +01:00
pyhash.c bpo-29410: Change the default hash algorithm to SipHash13. (GH-28752) 2021-10-10 17:29:46 +09:00
pylifecycle.c gh-59956: Clarify Runtime State Status Expectations (gh-101308) 2023-01-30 12:07:48 -07:00
pymath.c bpo-45440: Remove pymath.c fallbacks (GH-28977) 2021-10-15 19:45:34 +02:00
pystate.c gh-59956: Partial Fix for GILState API Compatibility with Subinterpreters (gh-101431) 2023-02-06 14:39:25 -07:00
pystrcmp.c bpo-41524: fix pointer bug in PyOS_mystr{n}icmp (GH-21845) 2020-08-27 14:45:25 +09:00
pystrhex.c gh-91768: C API no longer use "const PyObject*" type (#91769) 2022-04-21 22:07:19 +02:00
pystrtod.c bpo-45995: add "z" format specifer to coerce negative 0 to zero (GH-30049) 2022-04-11 15:34:18 +01:00
Python-ast.c gh-99300: Use Py_NewRef() in Python/Python-ast.c (#99499) 2022-11-15 10:29:56 +01:00
Python-tokenize.c gh-97973: Return all necessary information from the tokenizer (GH-97984) 2022-10-06 16:07:17 -07:00
pythonrun.c gh-99537: Use Py_SETREF() function in C code (#99657) 2022-11-22 13:39:11 +01:00
pytime.c gh-74953: Add _PyTime_FromMicrosecondsClamp() function (#93942) 2022-06-17 16:11:13 +02:00
README Issue #18093: Factor out the programs that embed the runtime 2014-07-25 21:52:14 +10:00
specialize.c GH-100288: Skip extra work when failing to specialize LOAD_ATTR (GH-101354) 2023-01-31 13:28:32 -08:00
stdlib_module_names.h gh-72719: Remove asyncore and asynchat modules (#96580) 2022-11-08 16:48:58 +01:00
structmember.c gh-99300: Replace Py_INCREF() with Py_NewRef() (#99530) 2022-11-16 18:34:24 +01:00
suggestions.c GH-81057: remove static state from suggestions.c (#99411) 2022-11-30 16:55:16 +05:30
symtable.c gh-87447: Fix walrus comprehension rebind checking (#100581) 2023-01-08 15:51:29 -07:00
sysmodule.c gh-86682: Adds sys._getframemodulename as an alternative to using _getframe (GH-99520) 2023-01-13 11:31:06 +00:00
thread.c gh-81057: Move Threading-Related Globals to _PyRuntimeState (#100084) 2022-12-08 17:50:58 -07:00
thread_nt.h gh-81057: Move Threading-Related Globals to _PyRuntimeState (#100084) 2022-12-08 17:50:58 -07:00
thread_pthread.h gh-81057: Fix the wasm32-wasi Buildbot (gh-100139) 2022-12-09 10:17:54 -07:00
thread_pthread_stubs.h gh-81057: Move Threading-Related Globals to _PyRuntimeState (#100084) 2022-12-08 17:50:58 -07:00
traceback.c gh-99537: Use Py_SETREF() function in C code (#99657) 2022-11-22 13:39:11 +01:00

Miscellaneous source files for the main Python shared library