[Jython-checkins] jython: Fixed #2600 by adding the current CPython 2.7.13 version of

stefan.richthofer jython-checkins at python.org
Mon Jul 10 18:31:05 EDT 2017


https://hg.python.org/jython/rev/1eab34823d61
changeset:   8118:1eab34823d61
user:        Stefan Richthofer <stefan.richthofer at gmx.de>
date:        Tue Jul 11 00:30:41 2017 +0200
summary:
  Fixed #2600 by adding the current CPython 2.7.13 version of subprocess._args_from_interpreter_flags.

files:
  Lib/subprocess.py |  32 ++++++++++++++++++++++++++++++++
  NEWS              |   1 +
  2 files changed, 33 insertions(+), 0 deletions(-)


diff --git a/Lib/subprocess.py b/Lib/subprocess.py
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -491,6 +491,38 @@
             raise
 
 
+# XXX This function is only used by multiprocessing and the test suite,
+# but it's here so that it can be imported when Python is compiled without
+# threads.
+
+def _args_from_interpreter_flags():
+    """Return a list of command-line arguments reproducing the current
+    settings in sys.flags and sys.warnoptions."""
+    flag_opt_map = {
+        'debug': 'd',
+        # 'inspect': 'i',
+        # 'interactive': 'i',
+        'optimize': 'O',
+        'dont_write_bytecode': 'B',
+        'no_user_site': 's',
+        'no_site': 'S',
+        'ignore_environment': 'E',
+        'verbose': 'v',
+        'bytes_warning': 'b',
+        'py3k_warning': '3',
+    }
+    args = []
+    for flag, opt in flag_opt_map.items():
+        v = getattr(sys.flags, flag)
+        if v > 0:
+            args.append('-' + opt * v)
+    if getattr(sys.flags, 'hash_randomization') != 0:
+        args.append('-R')
+    for opt in sys.warnoptions:
+        args.append('-W' + opt)
+    return args
+
+
 def call(*popenargs, **kwargs):
     """Run command with arguments.  Wait for command to complete, then
     return the returncode attribute.
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@
 
 Jython 2.7.2b1
   Bugs fixed
+    - [ 2600 ] subprocess doesn't have _args_from_interpreter_flags (blocks support for multiprocessing)
     - [ 2602 ] NumberFormatException in terminal on OSX 10.12.5 (ncurses related)
 
   New Features

-- 
Repository URL: https://hg.python.org/jython


More information about the Jython-checkins mailing list