[Jython-checkins] jython: Tolerate looser order of Python and Java arguments to launcher.

jeff.allen jython-checkins at python.org
Sat Apr 14 04:50:12 EDT 2018


https://hg.python.org/jython/rev/b556dcdf8258
changeset:   8154:b556dcdf8258
user:        Jeff Allen <ja.py at farowl.co.uk>
date:        Wed Mar 28 20:30:13 2018 +0100
summary:
  Tolerate looser order of Python and Java arguments to launcher.

This allows idioms like cmd = [sys.executable, '-E'].extend(args)
to succeed when args includes JVM arguments (e.g. in
Lib/test/script_helper.py). Currently only for jython.py launcher.

files:
  src/shell/jython.py |  7 ++++++-
  1 files changed, 6 insertions(+), 1 deletions(-)


diff --git a/src/shell/jython.py b/src/shell/jython.py
--- a/src/shell/jython.py
+++ b/src/shell/jython.py
@@ -104,6 +104,7 @@
     parsed.profile = False # --profile flag given
     parsed.properties = OrderedDict() # properties to give the JVM
     parsed.java = [] # any other arguments to give the JVM
+    unparsed = list()
 
     it = iter(args)
     next(it)  # ignore sys.argv[0]
@@ -143,13 +144,17 @@
         elif arg in (u"--boot", u"--jdb", u"--profile"):
             setattr(parsed, arg[2:], True)
             i += 1
+        elif len(arg) >= 2 and arg[0] == u'-' and arg[1] in u"BEisSuvV3":
+            unparsed.append(arg)
+            i += 1
         elif arg == u"--":
             i += 1
             break
         else:
             break
 
-    return parsed, args[i:]
+    unparsed.extend(args[i:])
+    return parsed, unparsed
 
 
 class JythonCommand(object):

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


More information about the Jython-checkins mailing list