Skip to content

Commit f23a9c1

Browse files
committed
Issue #27336: Fix compilation failures --without-threads
1 parent 541b2f6 commit f23a9c1

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

Parser/pgenmain.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,13 @@ Py_Exit(int sts)
3838
}
3939

4040
#ifdef WITH_THREAD
41-
/* Functions needed by obmalloc.c */
41+
/* Needed by obmalloc.c */
4242
int PyGILState_Check(void)
4343
{ return 1; }
44+
#endif
45+
4446
void _PyMem_DumpTraceback(int fd, const void *ptr)
4547
{}
46-
#endif
4748

4849
int
4950
main(int argc, char **argv)

Python/pylifecycle.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,9 +746,11 @@ Py_NewInterpreter(void)
746746
if (!initialized)
747747
Py_FatalError("Py_NewInterpreter: call Py_Initialize first");
748748

749+
#if WITH_THREAD
749750
/* Issue #10915, #15751: The GIL API doesn't work with multiple
750751
interpreters: disable PyGILState_Check(). */
751752
_PyGILState_check_enabled = 0;
753+
#endif
752754

753755
interp = PyInterpreterState_New();
754756
if (interp == NULL)

Python/traceback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ _Py_DumpTracebackThreads(int fd, PyInterpreterState *interp,
745745
if (current_tstate == NULL) {
746746
/* Call _PyThreadState_UncheckedGet() instead of PyThreadState_Get()
747747
to not fail with a fatal error if the thread state is NULL. */
748-
current_thread = _PyThreadState_UncheckedGet();
748+
current_tstate = _PyThreadState_UncheckedGet();
749749
}
750750

751751
if (interp == NULL) {

0 commit comments

Comments
 (0)