From cc362eca7b93b9cad6fdd2b95aacff0dc68bc38c Mon Sep 17 00:00:00 2001 From: Florent Xicluna Date: Mon, 8 Mar 2010 13:32:17 +0000 Subject: Merged revisions 78777,78787,78790 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r78777 | florent.xicluna | 2010-03-08 00:49:03 +0100 (lun, 08 mar 2010) | 4 lines Backport the Popen.poll() protection from subprocess to multiprocessing. See #1731717. It should fix transient failures on test_multiprocessing. ........ r78787 | florent.xicluna | 2010-03-08 08:21:16 +0100 (lun, 08 mar 2010) | 2 lines Don't fail on a debug() statement, if the worker PID is (still) None. ........ r78790 | florent.xicluna | 2010-03-08 12:01:39 +0100 (lun, 08 mar 2010) | 2 lines On finalize, don't try to join not started process. ........ --- Lib/multiprocessing/forking.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Lib/multiprocessing/forking.py') diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py index 3c0f568927..5d66fa3273 100644 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -104,7 +104,12 @@ if sys.platform != 'win32': def poll(self, flag=os.WNOHANG): if self.returncode is None: - pid, sts = os.waitpid(self.pid, flag) + try: + pid, sts = os.waitpid(self.pid, flag) + except os.error: + # Child process not yet created. See #1731717 + # e.errno == errno.ECHILD == 10 + return None if pid == self.pid: if os.WIFSIGNALED(sts): self.returncode = -os.WTERMSIG(sts) -- cgit v1.2.1 From 72a8551cc7545f34f5514aa2f7f29043a89124ca Mon Sep 17 00:00:00 2001 From: Brian Curtin Date: Wed, 4 Aug 2010 15:47:24 +0000 Subject: Fix #9513 to remove relative imports from multiprocessing. The test suite currently skips test_multiprocessing on Windows because it fails on finding _multiprocessing in several win32-specific blocks. Removing the relative import lets this through and allows the test to run (and pass). --- Lib/multiprocessing/forking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/multiprocessing/forking.py') diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py index 5d66fa3273..a7e8eb79cd 100644 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -157,7 +157,7 @@ else: import time from pickle import dump, load, HIGHEST_PROTOCOL - from ._multiprocessing import win32, Connection, PipeConnection + from _multiprocessing import win32, Connection, PipeConnection from .util import Finalize def dump(obj, file, protocol=None): -- cgit v1.2.1 From c42a64b5b327b93c3fe12ed8d842a6a82ab4476b Mon Sep 17 00:00:00 2001 From: "R. David Murray" Date: Tue, 14 Dec 2010 01:38:16 +0000 Subject: 9162: fix license in multiprocessing files --- Lib/multiprocessing/forking.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'Lib/multiprocessing/forking.py') diff --git a/Lib/multiprocessing/forking.py b/Lib/multiprocessing/forking.py index a7e8eb79cd..d2a3208453 100644 --- a/Lib/multiprocessing/forking.py +++ b/Lib/multiprocessing/forking.py @@ -3,7 +3,33 @@ # # multiprocessing/forking.py # -# Copyright (c) 2006-2008, R Oudkerk --- see COPYING.txt +# Copyright (c) 2006-2008, R Oudkerk +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. Neither the name of author nor the names of any contributors may be +# used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. # import os -- cgit v1.2.1 From 3015dbf747a1bb3da52c590b2448fb9301d6996b Mon Sep 17 00:00:00 2001 From: Nick Coghlan Date: Sun, 30 Jan 2011 01:24:08 +0000 Subject: Issue #10845: Improve compatibility between multiprocessing on Windows and package, zipfile and directory execution (Reviewed by Antoine Pitrou and approved by Georg Brandl) --- Lib/multiprocessing/forking.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Lib/multiprocessing/forking.py') 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: -- cgit v1.2.1