Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ericsnowcurrently opened this issue Nov 21, 2024 · 0 comments
Assignees
Labels
3.14 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@ericsnowcurrently
Copy link
Member

ericsnowcurrently commented Nov 21, 2024

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

@ericsnowcurrently ericsnowcurrently added type-bug An unexpected behavior, bug, or error interpreter-core (Objects, Python, Grammar, and Parser dirs) 3.14 new features, bugs and security fixes labels Nov 21, 2024
@ericsnowcurrently ericsnowcurrently self-assigned this Nov 21, 2024
ericsnowcurrently added a commit that referenced this issue Nov 22, 2024
…f _PyRuntimeState (gh-127118)

We add some comments so contributors can be aware and we move one out-of-place field up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 new features, bugs and security fixes interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant