Brent Fulgham writes: > Titus -- any chance s/UNIX/pthreads/ ? I.e., would using something > like AOLserver's threading libraries help by providing more > thread-local storage in which to squirrel away various environment > data, dictionaries, etc.? The problem isn't a lack of thread-local storage. The problem is that *everything* in unix assumes a single environment and a single PWD. Of course we could emulate a complete unix-like virtual machine within every thread :-) > Idea: If Python forks a subshell, it inherits the parent > process's environment. That's probably the only time we really want > to let someone modify the os.environ -- so it can be passed to > a child. Let's set os.environ to a normal dict (i.e., break the connection to the process's actual environment) initialized to the contents of the environment. This fake environment can be passed to a child using execve. We would have to override os.system() and its cousins to use execve with this fake environment. We only need to figure out: 1. Whether we can just assign a dict to os.environ (and posix.environ?) to kill their special behaviors; 2. Whether such changes can be made separately in each interpreter without them affecting one another; 3. Whether special measures have to be taken to cause the fake environment dictionary to be garbage collected when the interpreter is destroyed. Regarding PWD there's nothing we can realistically do except document this limitation and clobber os.chdir() as suggested by Guido. Michael -- Michael Haggerty mhagger@alum.mit.edu
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4