-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed as not planned
Closed as not planned
Copy link
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-C-API
Description
Bug report
Bug description:
Hello
I have code that works in Python 3.11 and no longer works in Python 3.12. I'd like to get an explanation of what changed as I see that the full GIL Python-C API was rewritten in Python 3.12 (./Python/pystate.c
).
Basically I check that GIL lock is held by checking it this way:
bool IsGilHeld() {
return _PyThreadState_UncheckedGet() != nullptr;
}
And I test it with doing an intencive operation:
# Simulate some heavy ML workload.
for _ in range(10000000):
_ = random.random() * random.random()
In Python 3.11 _PyThreadState_UncheckedGet()
returns a pointer at some point and in 3.12 the function always returns a nullptr
.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Metadata
Metadata
Assignees
Labels
3.12only security fixesonly security fixes3.13bugs and security fixesbugs and security fixes3.14bugs and security fixesbugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)pendingThe issue will be closed if no feedback is providedThe issue will be closed if no feedback is providedtopic-C-API