]> granicus.if.org Git - python/commitdiff
Building with HP's cc on HP-UX turned up a couple of problems.
authorNeal Norwitz <nnorwitz@gmail.com>
Mon, 11 Sep 2006 08:51:17 +0000 (08:51 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Mon, 11 Sep 2006 08:51:17 +0000 (08:51 +0000)
_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.

This needs to be ported to HEAD.  I'll try to remember to do that tomorrow.
(Anyone, feel free to port it.)

Misc/NEWS
Python/pystate.c

index 1feda610a34557502a3227395f12dd958eda6ee7..fe9532ac135246ae16e2c3a9a2bb9f08ad0f2cf1 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -19,6 +19,9 @@ What's New in Python 2.5 release candidate 2?
 Core and builtins
 -----------------
 
+- Make _PyGILState_NoteThreadState() static, it was not used anywhere
+  outside of pystate.c and should not be necessary.
+
 - Bug #1551432: Exceptions do not define an explicit __unicode__ method.  This
   allows calling unicode() on exceptions classes directly to succeed.
 
index f591a597672f19f19a41831eb92e3d89de8bc4d0..639278f69020eccff59852e5aab1ca2ea88a2d69 100644 (file)
@@ -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