Skip to content

Commit 246ed23

Browse files
authored
gh-127117: ensure that _initial_thread is the last field of PyInterpreterState when Py_STACKREF_DEBUG is defined (#132721)
1 parent a16586c commit 246ed23

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Include/internal/pycore_interp_structs.h

+6-6
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ struct _is {
754754
* and should be placed at the beginning. */
755755
struct _ceval_state ceval;
756756

757-
/* This structure is carefully allocated so that it's correctly aligned
757+
/* This structure is carefully allocated so that it's correctly aligned
758758
* to avoid undefined behaviors during LOAD and STORE. The '_malloced'
759759
* field stores the allocated pointer address that will later be freed.
760760
*/
@@ -941,18 +941,18 @@ struct _is {
941941

942942
Py_ssize_t _interactive_src_count;
943943

944-
/* the initial PyInterpreterState.threads.head */
945-
_PyThreadStateImpl _initial_thread;
946-
// _initial_thread should be the last field of PyInterpreterState.
947-
// See https://github.com/python/cpython/issues/127117.
948-
949944
#if !defined(Py_GIL_DISABLED) && defined(Py_STACKREF_DEBUG)
950945
uint64_t next_stackref;
951946
_Py_hashtable_t *open_stackrefs_table;
952947
# ifdef Py_STACKREF_CLOSE_DEBUG
953948
_Py_hashtable_t *closed_stackrefs_table;
954949
# endif
955950
#endif
951+
952+
/* the initial PyInterpreterState.threads.head */
953+
_PyThreadStateImpl _initial_thread;
954+
// _initial_thread should be the last field of PyInterpreterState.
955+
// See https://github.com/python/cpython/issues/127117.
956956
};
957957

958958

0 commit comments

Comments
 (0)