[Python-checkins] r51858 - in python/trunk: Misc/NEWS Python/pystate.c

georg.brandl python-checkins at python.org
Mon Sep 11 11:38:36 CEST 2006


Author: georg.brandl
Date: Mon Sep 11 11:38:35 2006
New Revision: 51858

Modified:
   python/trunk/Misc/NEWS
   python/trunk/Python/pystate.c
Log:
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.



Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Mon Sep 11 11:38:35 2006
@@ -12,6 +12,9 @@
 Core and builtins
 -----------------
 
+- Make _PyGILState_NoteThreadState() static, it was not used anywhere
+  outside of pystate.c and should not be necessary.
+
 - Bug #1542051: Exceptions now correctly call PyObject_GC_UnTrack.
   Also make sure that every exception class has __module__ set to
   'exceptions'.

Modified: python/trunk/Python/pystate.c
==============================================================================
--- python/trunk/Python/pystate.c	(original)
+++ python/trunk/Python/pystate.c	Mon Sep 11 11:38:35 2006
@@ -309,9 +309,14 @@
 	*/
 #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 @@
    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


More information about the Python-checkins mailing list