Hi,

I'm building mod_wsgi on a system with the following definition in
apr.h:

   #define APR_HAS_THREADS           0

Whether or not this is a good idea is another matter, but I note that
mod_wsgi.c checks this macro in two inconsistent ways. For example,
the definition of 'struct InterpreterObject' uses:

   #if defined(APR_HAS_THREADS)
       apr_hash_t *tstate_table;
   #else
       PyThreadState *tstate;
   #endif

Everywhere else uses e.g.

   #if defined(APR_HAS_THREADS
      ...
   #else
      self->tstate = tstate;
      PyThreadState_Swap(save_tstate);
   #endif

When APR_THREADS is 0, as in my build, InterpreterObject is compiled
erroneously with InterpreterObject->tstate_table instead of
InterpreterObject->tstate. Later attempts to access self->tstate
generate compiler errors.

May I suggest the appended patch?

cheers,
Graeme

--- mod_wsgi.c.orig     2010-02-25 15:25:02.000000000 -0800
+++ mod_wsgi.c  2010-02-25 15:24:40.000000000 -0800
@@ -4388,7 +4388,7 @@
 static const char *wsgi_python_path = NULL;
 static const char *wsgi_python_eggs = NULL;

-#if defined(APR_HAS_THREADS)
+#if APR_HAS_THREADS
 static int wsgi_thread_count = 0;
 static apr_threadkey_t *wsgi_thread_key;
 #endif
@@ -4398,7 +4398,7 @@
     char *name;
     PyInterpreterState *interp;
     int owner;
-#if defined(APR_HAS_THREADS)
+#if APR_HAS_THREADS
     apr_hash_t *tstate_table;
 #else
     PyThreadState *tstate;
@@ -5090,7 +5090,7 @@
      */

     if (self->owner) {
-#if defined(APR_HAS_THREADS)
+#if APR_HAS_THREADS
         int thread_id = 0;
         int *thread_handle = NULL;

@@ -5145,7 +5145,7 @@
     PyEval_ReleaseLock();

     if (*self->name) {
-#if defined(APR_HAS_THREADS)
+#if APR_HAS_THREADS
         int thread_id = 0;
         int *thread_handle = NULL;

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to