diff options
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index f591a59..cc25e3e 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -309,9 +309,14 @@ PyThreadState_Swap(PyThreadState *newts) */ #if defined(Py_DEBUG) && defined(WITH_THREAD) if (newts) { + /* This can be called from PyEval_RestoreThread(). Similar + to it, we need to ensure errno doesn't change. + */ + int err = errno; PyThreadState *check = PyGILState_GetThisThreadState(); if (check && check->interp == newts->interp && check != newts) Py_FatalError("Invalid thread state for this thread"); + errno = err; } #endif return oldts; @@ -496,7 +501,7 @@ _PyGILState_Fini(void) { PyThread_delete_key(autoTLSkey); autoTLSkey = 0; - autoInterpreterState = NULL;; + autoInterpreterState = NULL; } /* When a thread state is created for a thread by some mechanism other than @@ -504,7 +509,7 @@ _PyGILState_Fini(void) it so it doesn't try to create another thread state for the thread (this is a better fix for SF bug #1010677 than the first one attempted). */ -void +static void _PyGILState_NoteThreadState(PyThreadState* tstate) { /* If autoTLSkey is 0, this must be the very first threadstate created |