summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-09-11 09:38:35 (GMT)
committerGeorg Brandl <georg@python.org>2006-09-11 09:38:35 (GMT)
commitec6c2dfb63f76dca8b10f493c5b5d3c296900796 (patch)
tree12cee9358414e4b39aa6bbccf257e90387bbe07f /Python
parent361b46be24ae74f50a8e823c926c9e974c7c8602 (diff)
downloadcpython-ec6c2dfb63f76dca8b10f493c5b5d3c296900796.zip
cpython-ec6c2dfb63f76dca8b10f493c5b5d3c296900796.tar.gz
cpython-ec6c2dfb63f76dca8b10f493c5b5d3c296900796.tar.bz2
Forward-port of rev. 51857:
Building with HP's cc on HP-UX turned up a couple of problems. _PyGILState_NoteThreadState was declared as static inconsistently. Make it static as it's not necessary outside of this module. Some tests failed because errno was reset to 0. (I think the tests that failed were at least: test_fcntl and test_mailbox). Ensure that errno doesn't change after a call to Py_END_ALLOW_THREADS. This only affected debug builds.
Diffstat (limited to 'Python')
-rw-r--r--Python/pystate.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index f591a59..639278f 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;
@@ -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