[ZODB-Dev] strange testConnection error

John Belmonte john at neggie.net
Sat Apr 16 17:50:10 EDT 2005


I wrote:
> The consensus on the mod_python mailing list is that this is a bug in 
> Python 2.4 (which was backported to 2.3.5).  See 
> <http://sourceforge.net/tracker/index.php?func=detail&aid=1163563&group_id=5470&atid=105470>. 
>  The other possibility is that both JEP and mod_python are doing 
> something bad and Python 2.4 has exposed it.

Following is the exact change to Python that seems to have brought up 
the problem.  See 
<http://sourceforge.net/tracker/index.php?func=detail&aid=1010677&group_id=5470&atid=305470>.


Index: Modules/threadmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/threadmodule.c,v
retrieving revision 2.56
retrieving revision 2.56.8.1
diff -u -r2.56 -r2.56.8.1
--- Modules/threadmodule.c     16 Jun 2003 18:51:28 -0000      2.56
+++ Modules/threadmodule.c     1 Sep 2004 22:31:23 -0000       2.56.8.1
@@ -172,11 +172,10 @@
  t_bootstrap(void *boot_raw)
  {
        struct bootstate *boot = (struct bootstate *) boot_raw;
-      PyThreadState *tstate;
+      PyGILState_STATE gstate;
        PyObject *res;

-      tstate = PyThreadState_New(boot->interp);
-      PyEval_AcquireThread(tstate);
+      gstate = PyGILState_Ensure();
        res = PyEval_CallObjectWithKeywords(
                boot->func, boot->args, boot->keyw);
        if (res == NULL) {
@@ -201,8 +200,7 @@
        Py_DECREF(boot->args);
        Py_XDECREF(boot->keyw);
        PyMem_DEL(boot_raw);
-      PyThreadState_Clear(tstate);
-      PyThreadState_DeleteCurrent();
+      PyGILState_Release(gstate);
        PyThread_exit_thread();
  }


More information about the ZODB-Dev mailing list