# HG changeset patch # User schlamar # Date 1395052147 -3600 # Mon Mar 17 11:29:07 2014 +0100 # Branch 2.7 # Node ID b8df3ef164dda3f53943f07618a2c19f8eaf07da # Parent 67ada6ab7fe25219ca522a5dc1631a910b783884 Issue20954: fixed possible MemoryError in _args_from_interpreter_flags. diff -r 67ada6ab7fe2 -r b8df3ef164dd Lib/subprocess.py --- a/Lib/subprocess.py Thu Mar 13 16:17:11 2014 -0400 +++ b/Lib/subprocess.py Mon Mar 17 11:29:07 2014 +0100 @@ -505,6 +505,8 @@ for flag, opt in flag_opt_map.items(): v = getattr(sys.flags, flag) if v > 0: + if flag == 'hash_randomization': + v = 1 # Handle specification of an exact seed args.append('-' + opt * v) for opt in sys.warnoptions: args.append('-W' + opt) diff -r 67ada6ab7fe2 -r b8df3ef164dd Lib/test/test_multiprocessing.py --- a/Lib/test/test_multiprocessing.py Thu Mar 13 16:17:11 2014 -0400 +++ b/Lib/test/test_multiprocessing.py Mon Mar 17 11:29:07 2014 +0100 @@ -2431,6 +2431,24 @@ child_flags, grandchild_flags = json.loads(data.decode('ascii')) self.assertEqual(child_flags, grandchild_flags) + @classmethod + def grandchild_hash_seed(cls): + pass + + @classmethod + def child_hash_seed(cls): + p = multiprocessing.Process(target=cls.grandchild_hash_seed) + p.start() + p.join() + + def test_hash_seed(self): # Issue20954 + import subprocess + prog = ('from test.test_multiprocessing import TestFlags; ' + + 'TestFlags.child_hash_seed()') + env = os.environ.copy() + env['PYTHONHASHSEED'] = '2147483647' + subprocess.check_call([sys.executable, '-c', prog], env=env) + # # Issue #17555: ForkAwareThreadLock #