gh-94673: Clarify About Runtime State Related to Static Builtin Types#117761
Conversation
gvanrossum
left a comment
There was a problem hiding this comment.
Hm. With suitable explanation we may not need the runtime counter -- we can just explain that the index is assigned by the main thread based upon its counter.
Sorry, something went wrong.
This reverts commit b8d622e.
Good point. I've dropped the extra counter. |
Sorry, something went wrong.
gvanrossum
left a comment
There was a problem hiding this comment.
Perfect!
Sorry, something went wrong.
… Types (pythongh-117761) Guido pointed out to me that some details about the per-interpreter state for the builtin types aren't especially clear. I'm addressing that by: * adding a comment explaining that state * adding some asserts to point out the relationship between each index and the interp/global runtime state
|
After this PR, |
Sorry, something went wrong.
Guido pointed out to me that some details about the per-interpreter state for the builtin types aren't especially clear. I'm addressing that by:
_PyRuntimeState.types.next_builtin_indexRegarding
next_builtin_index, it replaces our use of the main interpreter'sinterp->types.num_builtins_initializedas the next index. Even though it's technically redundant, the distinct global runtime field helps clarify explicitly that each index is from global state.