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:
@@ -1393,10 +1393,8 @@ interp_look_up_id(_PyRuntimeState *runtime, int64_t requested_id)
|
||||
{
|
||||
PyInterpreterState *interp = runtime->interpreters.head;
|
||||
while (interp != NULL) {
|
||||
int64_t id = PyInterpreterState_GetID(interp);
|
||||
if (id < 0) {
|
||||
return NULL;
|
||||
}
|
||||
int64_t id = interp->id;
|
||||
assert(id >= 0);
|
||||
if (requested_id == id) {
|
||||
return interp;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user