[Python-Dev] PyWX (Python AOLserver plugin)

Greg Stein gstein@lyra.org
Tue, 12 Sep 2000 14:50:54 -0700


On Tue, Sep 12, 2000 at 12:03:55PM -0600, Neil Schemenauer wrote:
>...
> On Tue, Sep 12, 2000 at 10:40:36AM -0700, Brent Fulgham wrote:
>...
> > This is largely true, but we run across trouble with the way
> > the individual threads handle 'argv' variables and current
> > working directory.

Are you using Py_NewInterpreter? If so, then it will use the same argv
across all interpreters that it creates. Use PyInterpreterState_New, you
have finer-grained control of what goes into an interpreter/thread state
pair.

> > CGI scripts typically pass data as variables to the script
> > (as argv).  These (unfortunately) are changed globally across
> > all Python interpreter threads, which can cause problems....

They're sharing a list, I believe. See above.

This will definitely be true if you have a single interpreter and multiple
thread states.

> > In addition, the current working directory is not unique
> > among independent Python interpreters.  So if a script changes
> > its directory to something, all other running scripts (in
> > unique python interpreter threads) now have their cwd set to
> > this directory.

As pointed out elsewhere, this is a factor of the OS, not Python. And
Python's design really isn't going to attempt to address this (it really
doesn't make much sense to change these semantics).

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/