This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author amaury.forgeotdarc
Recipients TarkaSteve, amaury.forgeotdarc, benjamin.peterson, pitrou
Date 2008-09-06.12:46:37
SpamBayes Score 3.122873e-05
Marked as misclassified No
Message-id <1220705198.61.0.98551526827.issue3792@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2008-09-06 12:46:38amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, pitrou, benjamin.peterson, TarkaSteve
2008-09-06 12:46:38amaury.forgeotdarcsetmessageid: <1220705198.61.0.98551526827.issue3792@psf.upfronthosting.co.za>
2008-09-06 12:46:37amaury.forgeotdarclinkissue3792 messages
2008-09-06 12:46:37amaury.forgeotdarccreate