Python with Apache 2.0

Graham Dumpleton grahamd at dscpl.com.au
Mon Nov 22 04:59:16 EST 2004


Steve Holden <steve at holdenweb.com> wrote in message news:<S_xnd.1300$QR.188 at lakeread01>...
> Damjan wrote:
> 
> >>Does python support threads safely along with Apache 2.0 in web
> >>applications.
> > 
> > 
> > Are you talking about mod_python?
> > If so, then yes. But note that Apache threads entering the python
> > interpreter (via mod_python) will be serialized on the GIL.
> > 
> > 
> This is true, but it doesn't tell the whoel story: mod_python has taken 
> care to make it possible to configure multiple interpreters - on a 
> per-directory basis if necessary. Obviously they all share the pure 
> code, but if I undestand correctly each has its own data space, and 
> hence its own GIL.

There is actually a possible bug in PythonInterpPerDirectory directive
which applies even if threading isn't being used. Specifically, mod_python
doesn't calculate the interpreter name correctly and although access to a
directory by name and something in it should logically resolve to the
same interpreter name it doesn't. More information can be found at:

  http://www.modpython.org/pipermail/mod_python/2004-November/016788.html

Overall, I am not sure that PythonInterpPerDirectory is a good idea, but
then it probably was created to workaround the short comings of the
module importing system in mod_python which makes it impossible in
mod_python.publisher to have an index.py file in separate directories
within the context of the one interpreter. It wouldn't take much effort to
fix this limitation in the module importing system, but there doesn't seem
to be much interest in doing so.



More information about the Python-list mailing list