diff options
author | R David Murray <rdmurray@bitdance.com> | 2011-03-16 18:27:34 -0400 |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2011-03-16 18:27:34 -0400 |
commit | 676a72be33700a3df9f4930b7b080b800a93b011 (patch) | |
tree | eeb73490e177be33ff1741b4ae6afcad190ff8ad /Lib/multiprocessing/forking.py | |
parent | a6101cb3d1d6ebffa18cf7a784bdcaf98ee840d9 (diff) | |
parent | a8ebdf3fd2c681864e0b6b0c6c4364cf6242904d (diff) | |
download | cpython-676a72be33700a3df9f4930b7b080b800a93b011.tar.gz |
Merge #11401 fix from 3.1.
Diffstat (limited to 'Lib/multiprocessing/forking.py')
-rw-r--r-- | Lib/multiprocessing/forking.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py index d2a3208453..8ddddb60b5 100644 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -459,12 +459,20 @@ def prepare(data): process.ORIGINAL_DIR = data['orig_dir'] if 'main_path' in data: + # XXX (ncoghlan): The following code makes several bogus + # assumptions regarding the relationship between __file__ + # and a module's real name. See PEP 302 and issue #10845 main_path = data['main_path'] main_name = os.path.splitext(os.path.basename(main_path))[0] if main_name == '__init__': main_name = os.path.basename(os.path.dirname(main_path)) - if main_name != 'ipython': + if main_name == '__main__': + main_module = sys.modules['__main__'] + main_module.__file__ = main_path + elif main_name != 'ipython': + # Main modules not actually called __main__.py may + # contain additional code that should still be executed import imp if main_path is None: |