Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
57327a9e
Commit
57327a9e
authored
Sep 08, 2010
by
Antoine Pitrou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #9797: pystate.c wrongly assumed that zero couldn't be a valid
thread-local storage key.
parent
172a57df
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
8 deletions
+10
-8
Misc/NEWS
Misc/NEWS
+3
-0
Python/pystate.c
Python/pystate.c
+7
-8
No files found.
Misc/NEWS
View file @
57327a9e
...
@@ -10,6 +10,9 @@ What's New in Python 3.2 Alpha 3?
...
@@ -10,6 +10,9 @@ What's New in Python 3.2 Alpha 3?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #9797: pystate.c wrongly assumed that zero couldn't be a valid
thread-local storage key.
Library
Library
-------
-------
...
...
Python/pystate.c
View file @
57327a9e
...
@@ -340,7 +340,7 @@ PyThreadState_Delete(PyThreadState *tstate)
...
@@ -340,7 +340,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
(
auto
TLSkey
&&
PyThread_get_key_value
(
autoTLSkey
)
==
tstate
)
if
(
auto
InterpreterState
&&
PyThread_get_key_value
(
autoTLSkey
)
==
tstate
)
PyThread_delete_key_value
(
autoTLSkey
);
PyThread_delete_key_value
(
autoTLSkey
);
#endif
/* WITH_THREAD */
#endif
/* WITH_THREAD */
}
}
...
@@ -357,7 +357,7 @@ PyThreadState_DeleteCurrent()
...
@@ -357,7 +357,7 @@ PyThreadState_DeleteCurrent()
"PyThreadState_DeleteCurrent: no current tstate"
);
"PyThreadState_DeleteCurrent: no current tstate"
);
_Py_atomic_store_relaxed
(
&
_PyThreadState_Current
,
NULL
);
_Py_atomic_store_relaxed
(
&
_PyThreadState_Current
,
NULL
);
tstate_delete_common
(
tstate
);
tstate_delete_common
(
tstate
);
if
(
auto
TLSkey
&&
PyThread_get_key_value
(
autoTLSkey
)
==
tstate
)
if
(
auto
InterpreterState
&&
PyThread_get_key_value
(
autoTLSkey
)
==
tstate
)
PyThread_delete_key_value
(
autoTLSkey
);
PyThread_delete_key_value
(
autoTLSkey
);
PyEval_ReleaseLock
();
PyEval_ReleaseLock
();
}
}
...
@@ -580,7 +580,6 @@ void
...
@@ -580,7 +580,6 @@ void
_PyGILState_Fini
(
void
)
_PyGILState_Fini
(
void
)
{
{
PyThread_delete_key
(
autoTLSkey
);
PyThread_delete_key
(
autoTLSkey
);
autoTLSkey
=
0
;
autoInterpreterState
=
NULL
;
autoInterpreterState
=
NULL
;
}
}
...
@@ -592,10 +591,10 @@ _PyGILState_Fini(void)
...
@@ -592,10 +591,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 is
n'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
(
!
auto
TLSkey
)
if
(
!
auto
InterpreterState
)
return
;
return
;
/* Stick the thread state for this thread in thread local storage.
/* Stick the thread state for this thread in thread local storage.
...
@@ -623,7 +622,7 @@ _PyGILState_NoteThreadState(PyThreadState* tstate)
...
@@ -623,7 +622,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
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment