Message72665
Well, I get the OP's expected result on windows:
C:\dev\python\trunk>PCbuild\python_d t.py
Got 'p' of Correct
C:\dev\python\trunk>PCbuild\python_d t.py -m
Got 'p' of Correct
This is easy to explain: on Unix, the forked process has a copy of the
memory and reads the last value in the module.
But on Windows, the freshly spawned process imports the module, and get
the initial value (since it does not enter the "__main__" block).
This is documented:
http://docs.python.org/dev/library/multiprocessing.html#windows , under
"Global Variables".
By the way, the Windows way may have some advantages for some uses.
Could the same method (start a new interpreter, import modules, copy
needed objects), be made available on Unix? |
|
Date |
User |
Action |
Args |
2008-09-06 12:46:38 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, pitrou, benjamin.peterson, TarkaSteve |
2008-09-06 12:46:38 | amaury.forgeotdarc | set | messageid: <1220705198.61.0.98551526827.issue3792@psf.upfronthosting.co.za> |
2008-09-06 12:46:37 | amaury.forgeotdarc | link | issue3792 messages |
2008-09-06 12:46:37 | amaury.forgeotdarc | create | |
|