summaryrefslogtreecommitdiffstats
path: root/Include/internal
diff options
context:
space:
mode:
authorEric Snow <ericsnowcurrently@gmail.com>2024-11-22 16:37:02 (GMT)
committerGitHub <noreply@github.com>2024-11-22 16:37:02 (GMT)
commit5ba67af006079915af0a1312735efc40fa36c4f3 (patch)
tree4e2de32f20025cedd566758422587f8bed57b5df /Include/internal
parenta5440d4a38316cc709ce0304175beda124b8e7f4 (diff)
downloadcpython-5ba67af006079915af0a1312735efc40fa36c4f3.zip
cpython-5ba67af006079915af0a1312735efc40fa36c4f3.tar.gz
cpython-5ba67af006079915af0a1312735efc40fa36c4f3.tar.bz2
gh-127117: Ensure the Correct Last Fields of PyInterpreterState and of _PyRuntimeState (gh-127118)
We add some comments so contributors can be aware and we move one out-of-place field up.
Diffstat (limited to 'Include/internal')
-rw-r--r--Include/internal/pycore_interp.h2
-rw-r--r--Include/internal/pycore_runtime.h15
2 files changed, 10 insertions, 7 deletions
diff --git a/Include/internal/pycore_interp.h b/Include/internal/pycore_interp.h
index 5e4bcbf..87cdcb5 100644
--- a/Include/internal/pycore_interp.h
+++ b/Include/internal/pycore_interp.h
@@ -283,6 +283,8 @@ struct _is {
/* the initial PyInterpreterState.threads.head */
_PyThreadStateImpl _initial_thread;
+ // _initial_thread should be the last field of PyInterpreterState.
+ // See https://github.com/python/cpython/issues/127117.
};
diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h
index 2f2cec2..86d0245 100644
--- a/Include/internal/pycore_runtime.h
+++ b/Include/internal/pycore_runtime.h
@@ -169,6 +169,12 @@ typedef struct pyruntimestate {
struct _Py_unicode_runtime_state unicode_state;
struct _types_runtime_state types;
+#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
+ // Used in "Python/emscripten_trampoline.c" to choose between type
+ // reflection trampoline and EM_JS trampoline.
+ bool wasm_type_reflection_available;
+#endif
+
/* All the objects that are shared by the runtime's interpreters. */
struct _Py_cached_objects cached_objects;
struct _Py_static_objects static_objects;
@@ -189,13 +195,8 @@ typedef struct pyruntimestate {
/* _PyRuntimeState.interpreters.main */
PyInterpreterState _main_interpreter;
-
-#if defined(__EMSCRIPTEN__) && defined(PY_CALL_TRAMPOLINE)
- // Used in "Python/emscripten_trampoline.c" to choose between type
- // reflection trampoline and EM_JS trampoline.
- bool wasm_type_reflection_available;
-#endif
-
+ // _main_interpreter should be the last field of _PyRuntimeState.
+ // See https://github.com/python/cpython/issues/127117.
} _PyRuntimeState;