summaryrefslogtreecommitdiffstats
path: root/Include/internal/pycore_runtime.h
diff options
context:
space:
mode:
authorPablo Galindo Salgado <Pablogsal@gmail.com>2023-06-27 15:26:53 (GMT)
committerGitHub <noreply@github.com>2023-06-27 15:26:53 (GMT)
commit2d5a1c281161d037148ffb5983decc6d31c2557d (patch)
treee78657e25e2f9e2cd04e7874a5dc0f2be8764fb0 /Include/internal/pycore_runtime.h
parentbb578a0c304dffe43bb28b36b2b1c9153c78b659 (diff)
downloadcpython-2d5a1c281161d037148ffb5983decc6d31c2557d.zip
cpython-2d5a1c281161d037148ffb5983decc6d31c2557d.tar.gz
cpython-2d5a1c281161d037148ffb5983decc6d31c2557d.tar.bz2
gh-106140: Reorder some fields to facilitate out-of-process inspection (#106143)
Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
Diffstat (limited to 'Include/internal/pycore_runtime.h')
-rw-r--r--Include/internal/pycore_runtime.h22
1 files changed, 14 insertions, 8 deletions
diff --git a/Include/internal/pycore_runtime.h b/Include/internal/pycore_runtime.h
index 8f51e2d..5ed97e9 100644
--- a/Include/internal/pycore_runtime.h
+++ b/Include/internal/pycore_runtime.h
@@ -84,13 +84,6 @@ typedef struct pyruntimestate {
to access it, don't access it directly. */
_Py_atomic_address _finalizing;
- struct _pymem_allocators allocators;
- struct _obmalloc_global_state obmalloc;
- struct pyhash_runtime_state pyhash_state;
- struct _time_runtime_state time;
- struct _pythread_runtime_state threads;
- struct _signals_runtime_state signals;
-
struct pyinterpreters {
PyThread_type_lock mutex;
/* The linked list of interpreters, newest first. */
@@ -109,13 +102,26 @@ typedef struct pyruntimestate {
using a Python int. */
int64_t next_id;
} interpreters;
+
+ unsigned long main_thread;
+
+ /* ---------- IMPORTANT ---------------------------
+ The fields above this line are declared as early as
+ possible to facilitate out-of-process observability
+ tools. */
+
// XXX Remove this field once we have a tp_* slot.
struct _xidregistry {
PyThread_type_lock mutex;
struct _xidregitem *head;
} xidregistry;
- unsigned long main_thread;
+ struct _pymem_allocators allocators;
+ struct _obmalloc_global_state obmalloc;
+ struct pyhash_runtime_state pyhash_state;
+ struct _time_runtime_state time;
+ struct _pythread_runtime_state threads;
+ struct _signals_runtime_state signals;
/* Used for the thread state bound to the current thread. */
Py_tss_t autoTSSkey;