The last field of PyInterpreterState should be _initial_thread and the last field of _PyRuntimeState should be _main_interpreter. Respectively, they are the preallocated struct values that are used for the "main" thread and main interpreter.
Having them at the end simplifies some backporting scenarios. It also gives better locality to all the state in the respective interpreter/runtime; otherwise any fields after _initial_thread or _main_interpreter will be separated from the rest by those structs.
I'll make sure there's a note on each struct and that any out-of-place fields are moved up.
The last field of
PyInterpreterState
should be_initial_thread
and the last field of_PyRuntimeState
should be_main_interpreter
. Respectively, they are the preallocated struct values that are used for the "main" thread and main interpreter.Having them at the end simplifies some backporting scenarios. It also gives better locality to all the state in the respective interpreter/runtime; otherwise any fields after
_initial_thread
or_main_interpreter
will be separated from the rest by those structs.I'll make sure there's a note on each struct and that any out-of-place fields are moved up.
Linked PRs