diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2024-08-15 18:42:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-15 18:42:41 (GMT) |
commit | d7a3df91505faa56c51d169648253bd0d57ddae2 (patch) | |
tree | c7f45d612f5d63907d4e4140517715999a1078ec /Python | |
parent | b15b81ed4f58196b35e3dd13b484f4c7a73e5bb8 (diff) | |
download | cpython-d7a3df91505faa56c51d169648253bd0d57ddae2.zip cpython-d7a3df91505faa56c51d169648253bd0d57ddae2.tar.gz cpython-d7a3df91505faa56c51d169648253bd0d57ddae2.tar.bz2 |
Add debug offsets for free threaded builds (#123041)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pylifecycle.c | 2 | ||||
-rw-r--r-- | Python/pystate.c | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c index 3a41c64..27faf72 100644 --- a/Python/pylifecycle.c +++ b/Python/pylifecycle.c @@ -104,7 +104,7 @@ _PyRuntimeState _PyRuntime #if defined(__linux__) && (defined(__GNUC__) || defined(__clang__)) __attribute__ ((section (".PyRuntime"))) #endif -= _PyRuntimeState_INIT(_PyRuntime); += _PyRuntimeState_INIT(_PyRuntime, _Py_Debug_Cookie); _Py_COMP_DIAG_POP static int runtime_initialized = 0; 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); } |