Skip to content

The Last Fields of PyInterpreterState and of _PyRuntimeState Should Not Change #127117

@ericsnowcurrently

Description

@ericsnowcurrently

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

Metadata

Metadata

Labels

3.14bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions