8000 Drop interpreter_exists(). · python/cpython@3b07482 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3b07482

Browse files
Drop interpreter_exists().
1 parent d08ac68 commit 3b07482

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

Python/pystate.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,17 +1121,9 @@ PyInterpreterState_SetNotRunningMain(PyInterpreterState *interp)
11211121
interp->threads.main = NULL;
11221122
}
11231123

1124-
static int interpreter_exists(PyInterpreterState *);
1125-
11261124
int
11271125
PyInterpreterState_IsRunningMain(PyInterpreterState *interp)
11281126
{
1129-
HEAD_LOCK(interp->runtime);
1130-
int exists = interpreter_exists(interp);
1131-
HEAD_UNLOCK(interp->runtime);
1132-
if (!exists) {
1133-
return 0;
1134-
}
11351127
if (interp->threads.main == NULL) {
11361128
return 0;
11371129
}
@@ -1248,22 +1240,6 @@ PyInterpreterState_GetDict(PyInterpreterState *interp)
12481240
// look up an interpreter state
12491241
//-----------------------------
12501242

1251-
/* This must be called with the "head" lock held. */
1252-
static int
1253-
interpreter_exists(PyInterpreterState *interp)
1254-
{
1255-
PyInterpreterState *actual = interp->runtime->interpreters.head;
1256-
while (actual != NULL) {
1257-
if (actual == interp) {
1258-
return 1;
1259-
}
1260-
actual = actual->next;
1261-
}
1262-
// It's a dangling pointer.
1263-
return 0;
1264-
}
1265-
1266-
12671243
/* Return the interpreter associated with the current OS thread.
12681244
12691245
The GIL must be held.

0 commit comments

Comments
 (0)
0