summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2010-09-08 12:48:12 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2010-09-08 12:48:12 (GMT)
commit3c6261a90b4fb9e77c2967d84a03f526174775a7 (patch)
tree3618fc354622410131462de907d4e5e20ec3a517 /Python
parentb58c3c7e2fbdc3ecb75562e722f6d1e87c6be063 (diff)
downloadcpython-3c6261a90b4fb9e77c2967d84a03f526174775a7.zip
cpython-3c6261a90b4fb9e77c2967d84a03f526174775a7.tar.gz
cpython-3c6261a90b4fb9e77c2967d84a03f526174775a7.tar.bz2
Merged revisions 84623 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84623 | antoine.pitrou | 2010-09-08 14:37:10 +0200 (mer., 08 sept. 2010) | 4 lines Issue #9797: pystate.c wrongly assumed that zero couldn't be a valid thread-local storage key. ........
Diffstat (limited to 'Python')
-rw-r--r--Python/pystate.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 1c468c3..f1eb6d9 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -338,7 +338,7 @@ PyThreadState_Delete(PyThreadState *tstate)
Py_FatalError("PyThreadState_Delete: tstate is still current");
tstate_delete_common(tstate);
#ifdef WITH_THREAD
- if (autoTLSkey && PyThread_get_key_value(autoTLSkey) == tstate)
+ if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate)
PyThread_delete_key_value(autoTLSkey);
#endif /* WITH_THREAD */
}
@@ -354,7 +354,7 @@ PyThreadState_DeleteCurrent()
"PyThreadState_DeleteCurrent: no current tstate");
_PyThreadState_Current = NULL;
tstate_delete_common(tstate);
- if (autoTLSkey && PyThread_get_key_value(autoTLSkey) == tstate)
+ if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate)
PyThread_delete_key_value(autoTLSkey);
PyEval_ReleaseLock();
}
@@ -574,7 +574,6 @@ void
_PyGILState_Fini(void)
{
PyThread_delete_key(autoTLSkey);
- autoTLSkey = 0;
autoInterpreterState = NULL;
}
@@ -586,10 +585,10 @@ _PyGILState_Fini(void)
static void
_PyGILState_NoteThreadState(PyThreadState* tstate)
{
- /* If autoTLSkey is 0, this must be the very first threadstate created
- in Py_Initialize(). Don't do anything for now (we'll be back here
- when _PyGILState_Init is called). */
- if (!autoTLSkey)
+ /* If autoTLSkey isn't initialized, this must be the very first
+ threadstate created in Py_Initialize(). Don't do anything for now
+ (we'll be back here when _PyGILState_Init is called). */
+ if (!autoInterpreterState)
return;
/* Stick the thread state for this thread in thread local storage.
@@ -617,7 +616,7 @@ _PyGILState_NoteThreadState(PyThreadState* tstate)
PyThreadState *
PyGILState_GetThisThreadState(void)
{
- if (autoInterpreterState == NULL || autoTLSkey == 0)
+ if (autoInterpreterState == NULL)
return NULL;
return (PyThreadState *)PyThread_get_key_value(autoTLSkey);
}