Skip to content

Rename "own_gil" Field of PyInterpreterConfig to "gil" #105603

Closed
@ericsnowcurrently

Description

@ericsnowcurrently

We've added the PyInterpreterConfig struct in 3.12. For PEP 684 (per-interpreter GIL), likewise 3.12, we added a new int-boolean field, "own_gil", to indicate if PyInterpreterState.ceval.gil should point to the interpreter's own GIL.

Having finally just read through PEP 703 (no-gil), I realized that it would probably be useful to change that field to support a number of different values, rather than just a binary situation. Consequently, I'm proposing we change the field as follows (more or less):

#define PyInterpreterConfig_SHARED_GIL 1  /* shared with main interpreter, so PyInterpreterConfig_MAIN_GIL? */
#define PyInterpreterConfig_OWN_GIL 2

typedef struct {
    ...
    int gil;
    ...
} PyInterpreterConfig;

That would give us more flexibility for other possible future scenarios (e.g. no-gil), where "own_gil" wouldn't make sense.


Changing this in 3.12, even though we're past feature freeze, would be good so we don't have to live with a deprecated field in the struct. I'd be surprised if anyone was really using PyInterpreterConfig yet, and the change will be very focused, so we should be okay to make this change so late in the game.

CC @Yhg1s

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions