summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2024-08-15 18:42:41 (GMT)
committerGitHub <noreply@github.com>2024-08-15 18:42:41 (GMT)
commitd7a3df91505faa56c51d169648253bd0d57ddae2 (patch)
treec7f45d612f5d63907d4e4140517715999a1078ec /Python/pystate.c
parentb15b81ed4f58196b35e3dd13b484f4c7a73e5bb8 (diff)
downloadcpython-d7a3df91505faa56c51d169648253bd0d57ddae2.zip
cpython-d7a3df91505faa56c51d169648253bd0d57ddae2.tar.gz
cpython-d7a3df91505faa56c51d169648253bd0d57ddae2.tar.bz2
Add debug offsets for free threaded builds (#123041)
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index bba88b7..4d7bec6 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -390,7 +390,7 @@ _Py_COMP_DIAG_IGNORE_DEPR_DECLS
Note that we initialize "initial" relative to _PyRuntime,
to ensure pre-initialized pointers point to the active
runtime state (and not "initial"). */
-static const _PyRuntimeState initial = _PyRuntimeState_INIT(_PyRuntime);
+static const _PyRuntimeState initial = _PyRuntimeState_INIT(_PyRuntime, "");
_Py_COMP_DIAG_POP
#define LOCKS_INIT(runtime) \
@@ -455,6 +455,8 @@ _PyRuntimeState_Init(_PyRuntimeState *runtime)
// Py_Initialize() must be running again.
// Reset to _PyRuntimeState_INIT.
memcpy(runtime, &initial, sizeof(*runtime));
+ // Preserve the cookie from the original runtime.
+ memcpy(runtime->debug_offsets.cookie, _Py_Debug_Cookie, 8);
assert(!runtime->_initialized);
}