[Jython-checkins] jython: #1913 Support short -W options. Thanks Arfrever!
frank.wierzbicki
jython-checkins at python.org
Wed Jun 20 22:55:06 CEST 2012
http://hg.python.org/jython/rev/96eeda1f3d2f
changeset: 6723:96eeda1f3d2f
user: Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA at GMail.Com>
date: Wed Jun 20 13:54:50 2012 -0700
summary:
#1913 Support short -W options. Thanks Arfrever!
files:
NEWS | 1 +
src/org/python/util/jython.java | 21 +++++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/NEWS b/NEWS
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@
Jython 2.7a3
Bugs Fixed
+ - [ 1913 ] Support short -W options
- [ 1897 ] 2.7.0ax only has partial ssl support
- array_class in jarray module returns the "Array of a type" class
diff --git a/src/org/python/util/jython.java b/src/org/python/util/jython.java
--- a/src/org/python/util/jython.java
+++ b/src/org/python/util/jython.java
@@ -162,18 +162,23 @@
}
private static List<String> validWarnActions = Arrays.asList(
- "error", "ignore", "always", "default", "module", "once",
- "i");
+ "error", "ignore", "always", "default", "module", "once");
private static void addWarnings(List<String> from, PyList to) {
- for (String opt : from) {
+ outerLoop : for (String opt : from) {
String action = opt.split(":")[0];
- if (!validWarnActions.contains(action)) {
- System.err.println(String.format(
- "Invalid -W option ignored: invalid action: '%s'", action));
- continue;
+ for (String validWarnAction : validWarnActions) {
+ if (validWarnAction.startsWith(action)) {
+ if (opt.contains(":")) {
+ to.append(Py.newString(validWarnAction + opt.substring(opt.indexOf(":"))));
+ }
+ else {
+ to.append(Py.newString(validWarnAction));
+ }
+ continue outerLoop;
+ }
}
- to.append(Py.newString(opt));
+ System.err.println(String.format("Invalid -W option ignored: invalid action: '%s'", action));
}
}
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list