changeset: 89923:619331c67638 branch: 3.4 parent: 89921:4476b7493ee4 user: Richard Oudkerk date: Sun Mar 23 11:54:15 2014 +0000 files: Lib/multiprocessing/spawn.py Lib/multiprocessing/synchronize.py Misc/NEWS description: Issue #20990: Fix issues found by pyflakes for multiprocessing. diff -r 4476b7493ee4 -r 619331c67638 Lib/multiprocessing/spawn.py --- a/Lib/multiprocessing/spawn.py Sat Mar 22 20:38:11 2014 +0100 +++ b/Lib/multiprocessing/spawn.py Sun Mar 23 11:54:15 2014 +0000 @@ -64,7 +64,14 @@ Run code for process object if this in not the main process ''' if is_forking(sys.argv): - main() + kwds = {} + for arg in sys.argv[2:]: + name, value = arg.split('=') + if value == 'None': + kwds[name] = None + else: + kwds[name] = int(value) + spawn_main(**kwds) sys.exit() @@ -73,7 +80,8 @@ Returns prefix of command line used for spawning a child process ''' if getattr(sys, 'frozen', False): - return [sys.executable, '--multiprocessing-fork'] + tmp = ' '.join('%s=%r' % item for item in kwds.items()) + return [sys.executable, '--multiprocessing-fork'] + tmp else: prog = 'from multiprocessing.spawn import spawn_main; spawn_main(%s)' prog %= ', '.join('%s=%r' % item for item in kwds.items()) diff -r 4476b7493ee4 -r 619331c67638 Lib/multiprocessing/synchronize.py --- a/Lib/multiprocessing/synchronize.py Sat Mar 22 20:38:11 2014 +0100 +++ b/Lib/multiprocessing/synchronize.py Sun Mar 23 11:54:15 2014 +0000 @@ -49,9 +49,10 @@ _rand = tempfile._RandomNameSequence() def __init__(self, kind, value, maxvalue, *, ctx): - ctx = ctx or get_context() - ctx = ctx.get_context() - unlink_now = sys.platform == 'win32' or ctx._name == 'fork' + if ctx is None: + ctx = context._default_context.get_context() + name = ctx.get_start_method() + unlink_now = sys.platform == 'win32' or name == 'fork' for i in range(100): try: sl = self._semlock = _multiprocessing.SemLock( diff -r 4476b7493ee4 -r 619331c67638 Misc/NEWS --- a/Misc/NEWS Sat Mar 22 20:38:11 2014 +0100 +++ b/Misc/NEWS Sun Mar 23 11:54:15 2014 +0000 @@ -21,6 +21,8 @@ Library ------- +- Issue #20990: Fix issues found by pyflakes for multiprocessing. + - Issue #21015: SSL contexts will now automatically select an elliptic curve for ECDH key exchange on OpenSSL 1.0.2 and later, and otherwise default to "prime256v1".