summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_runtime_init.h
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2023-01-19 23:04:14 (GMT)
committerGitHub <noreply@github.com>2023-01-19 23:04:14 (GMT)
commit6036c3e856f033bf13e929536e7bf127fdd921c9 (patch)
tree2e0f92c60f4d860826e6e224e6c073e220d76386 /Include/internal/pycore_runtime_init.h
parent8a2d4f4e8eea86352de37d2ce28117e13b3dfaed (diff)
downloadcpython-6036c3e856f033bf13e929536e7bf127fdd921c9.zip
cpython-6036c3e856f033bf13e929536e7bf127fdd921c9.tar.gz
cpython-6036c3e856f033bf13e929536e7bf127fdd921c9.tar.bz2
gh-59956: Clarify GILState-related Code (gh-101161)
The objective of this change is to help make the GILState-related code easier to understand. This mostly involves moving code around and some semantically equivalent refactors. However, there are a also a small number of slight changes in structure and behavior: * tstate_current is moved out of _PyRuntimeState.gilstate * autoTSSkey is moved out of _PyRuntimeState.gilstate * autoTSSkey is initialized earlier * autoTSSkey is re-initialized (after fork) earlier https://github.com/python/cpython/issues/59956
Diffstat (limited to 'Include/internal/pycore_runtime_init.h')
-rw-r--r--Include/internal/pycore_runtime_init.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/Include/internal/pycore_runtime_init.h b/Include/internal/pycore_runtime_init.h
index cb3fce3..f10dccc 100644
--- a/Include/internal/pycore_runtime_init.h
+++ b/Include/internal/pycore_runtime_init.h
@@ -33,6 +33,9 @@ extern "C" {
until _PyInterpreterState_Enable() is called. */ \
.next_id = -1, \
}, \
+ /* A TSS key must be initialized with Py_tss_NEEDS_INIT \
+ in accordance with the specification. */ \
+ .autoTSSkey = Py_tss_NEEDS_INIT, \
.parser = _parser_runtime_state_INIT, \
.imports = { \
.lock = { \
@@ -49,9 +52,6 @@ extern "C" {
}, \
.gilstate = { \
.check_enabled = 1, \
- /* A TSS key must be initialized with Py_tss_NEEDS_INIT \
- in accordance with the specification. */ \
- .autoTSSkey = Py_tss_NEEDS_INIT, \
}, \
.dtoa = _dtoa_runtime_state_INIT(runtime), \
.fileutils = { \