Kaydet (Commit) 3c6261a9 authored tarafından Antoine Pitrou's avatar Antoine Pitrou

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.
........
üst b58c3c7e
...@@ -12,6 +12,9 @@ What's New in Python 3.1.3? ...@@ -12,6 +12,9 @@ What's New in Python 3.1.3?
Core and Builtins Core and Builtins
----------------- -----------------
- Issue #9797: pystate.c wrongly assumed that zero couldn't be a valid
thread-local storage key.
- Issue #9737: Fix a crash when trying to delete a slice or an item from - Issue #9737: Fix a crash when trying to delete a slice or an item from
a memoryview object. a memoryview object.
......
...@@ -338,7 +338,7 @@ PyThreadState_Delete(PyThreadState *tstate) ...@@ -338,7 +338,7 @@ PyThreadState_Delete(PyThreadState *tstate)
Py_FatalError("PyThreadState_Delete: tstate is still current"); Py_FatalError("PyThreadState_Delete: tstate is still current");
tstate_delete_common(tstate); tstate_delete_common(tstate);
#ifdef WITH_THREAD #ifdef WITH_THREAD
if (autoTLSkey && PyThread_get_key_value(autoTLSkey) == tstate) if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate)
PyThread_delete_key_value(autoTLSkey); PyThread_delete_key_value(autoTLSkey);
#endif /* WITH_THREAD */ #endif /* WITH_THREAD */
} }
...@@ -354,7 +354,7 @@ PyThreadState_DeleteCurrent() ...@@ -354,7 +354,7 @@ PyThreadState_DeleteCurrent()
"PyThreadState_DeleteCurrent: no current tstate"); "PyThreadState_DeleteCurrent: no current tstate");
_PyThreadState_Current = NULL; _PyThreadState_Current = NULL;
tstate_delete_common(tstate); 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); PyThread_delete_key_value(autoTLSkey);
PyEval_ReleaseLock(); PyEval_ReleaseLock();
} }
...@@ -574,7 +574,6 @@ void ...@@ -574,7 +574,6 @@ void
_PyGILState_Fini(void) _PyGILState_Fini(void)
{ {
PyThread_delete_key(autoTLSkey); PyThread_delete_key(autoTLSkey);
autoTLSkey = 0;
autoInterpreterState = NULL; autoInterpreterState = NULL;
} }
...@@ -586,10 +585,10 @@ _PyGILState_Fini(void) ...@@ -586,10 +585,10 @@ _PyGILState_Fini(void)
static void static void
_PyGILState_NoteThreadState(PyThreadState* tstate) _PyGILState_NoteThreadState(PyThreadState* tstate)
{ {
/* If autoTLSkey is 0, this must be the very first threadstate created /* If autoTLSkey isn't initialized, this must be the very first
in Py_Initialize(). Don't do anything for now (we'll be back here threadstate created in Py_Initialize(). Don't do anything for now
when _PyGILState_Init is called). */ (we'll be back here when _PyGILState_Init is called). */
if (!autoTLSkey) if (!autoInterpreterState)
return; return;
/* Stick the thread state for this thread in thread local storage. /* Stick the thread state for this thread in thread local storage.
...@@ -617,7 +616,7 @@ _PyGILState_NoteThreadState(PyThreadState* tstate) ...@@ -617,7 +616,7 @@ _PyGILState_NoteThreadState(PyThreadState* tstate)
PyThreadState * PyThreadState *
PyGILState_GetThisThreadState(void) PyGILState_GetThisThreadState(void)
{ {
if (autoInterpreterState == NULL || autoTLSkey == 0) if (autoInterpreterState == NULL)
return NULL; return NULL;
return (PyThreadState *)PyThread_get_key_value(autoTLSkey); return (PyThreadState *)PyThread_get_key_value(autoTLSkey);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment