summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2024-08-18 15:01:16 (GMT)
committerGitHub <noreply@github.com>2024-08-18 15:01:16 (GMT)
commit01ce10c690dfe07dae227994f127d2f7a7d36e82 (patch)
treeecddb165c97644069664abc03d8b2ebf321b4fec /Python
parentb5bba3bb6c2ea14168ee89f7893844ab1fc88afb (diff)
downloadcpython-01ce10c690dfe07dae227994f127d2f7a7d36e82.zip
cpython-01ce10c690dfe07dae227994f127d2f7a7d36e82.tar.gz
cpython-01ce10c690dfe07dae227994f127d2f7a7d36e82.tar.bz2
[3.13] Add debug offsets for free threaded builds (GH-123041) (#123055)
* Add debug offsets for free threaded builds (GH-123041) (cherry picked from commit d7a3df91505faa56c51d169648253bd0d57ddae2) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> * Refresh ABI file --------- Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
Diffstat (limited to 'Python')
-rw-r--r--Python/pylifecycle.c2
-rw-r--r--Python/pystate.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 13bd62d..1701a1c 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -103,7 +103,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 f0452aa..66fd392 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -389,7 +389,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) \
@@ -454,6 +454,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);
}