mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Simplify interp_look_up_id() (#134257)
Don't use PyInterpreterState_GetID() but get directly the interpreter 'id' member which cannot fail.
This commit is contained in:
parent
71c42b778d
commit
e79f640eb6
1 changed files with 2 additions and 4 deletions
|
@ -1393,10 +1393,8 @@ interp_look_up_id(_PyRuntimeState *runtime, int64_t requested_id)
|
||||||
{
|
{
|
||||||
PyInterpreterState *interp = runtime->interpreters.head;
|
PyInterpreterState *interp = runtime->interpreters.head;
|
||||||
while (interp != NULL) {
|
while (interp != NULL) {
|
||||||
int64_t id = PyInterpreterState_GetID(interp);
|
int64_t id = interp->id;
|
||||||
if (id < 0) {
|
assert(id >= 0);
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
if (requested_id == id) {
|
if (requested_id == id) {
|
||||||
return interp;
|
return interp;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue