[Jython-checkins] jython: Ensure regrtest runs in a C locale to avoid failures.

jim.baker jython-checkins at python.org
Wed Oct 29 01:08:47 CET 2014


https://hg.python.org/jython/rev/7a70d824e7bd
changeset:   7403:7a70d824e7bd
user:        YAMANO Yuji <Yamano_Yuji at ogis-ri.co.jp>
date:        Tue Oct 28 18:08:23 2014 -0600
summary:
  Ensure regrtest runs in a C locale to avoid failures.

Fixes http://bugs.jython.org/issue1708

files:
  ACKNOWLEDGMENTS                     |   1 +
  build.xml                           |   1 +
  src/org/python/core/PyJavaType.java |  42 +++++++++++++++++
  3 files changed, 44 insertions(+), 0 deletions(-)


diff --git a/ACKNOWLEDGMENTS b/ACKNOWLEDGMENTS
--- a/ACKNOWLEDGMENTS
+++ b/ACKNOWLEDGMENTS
@@ -114,6 +114,7 @@
     Henning Jacobs
     Darjus Loktevic
     Raphael Jolly
+    Yuji Yamano
 
 Local Variables:
 mode: indented-text
diff --git a/build.xml b/build.xml
--- a/build.xml
+++ b/build.xml
@@ -1021,6 +1021,7 @@
     <target name="regrtest" depends="developer-build,regrtest-unix,regrtest-windows" description="run Python tests expected to work on Jython"/>
     <target name="regrtest-unix" if="os.family.unix">
       <exec executable="${dist.dir}/bin/jython">
+	<env key="JAVA_OPTS" value="-Duser.language=en -Duser.region=US"/>
         <arg value="${dist.dir}/Lib/test/regrtest.py"/>
         <!-- Only run the tests that are expected to work on Jython -->
         <arg value="--expected"/>
diff --git a/src/org/python/core/PyJavaType.java b/src/org/python/core/PyJavaType.java
--- a/src/org/python/core/PyJavaType.java
+++ b/src/org/python/core/PyJavaType.java
@@ -1053,6 +1053,48 @@
                     }
                 }
             };
+            PyBuiltinMethodNarrow mapLeProxy = new MapMethod("__le__", 1) {
+//                if not isinstance(other, Set):
+//                    return NotImplemented
+//                if len(self) > len(other):
+//                    return False
+//                for elem in self:
+//                    if elem not in other:
+//                        return False
+//                return True
+
+                @Override
+                public PyObject __call__(PyObject other) {
+                    PyObject mapping =
+                    if (!Py.isInstance(other, ))
+                    if (other.getType().isSubType(PyDictionary.TYPE)) {
+                        PyDictionary oDict = (PyDictionary) other;
+                        if (asMap().size() != oDict.size()) {
+                            return Py.False;
+                        }
+                        for (Object jkey : asMap().keySet()) {
+                            Object jval = asMap().get(jkey);
+                            PyObject oVal = oDict.__finditem__(Py.java2py(jkey));
+                            if (oVal == null) {
+                                return Py.False;
+                            }
+                            if (!Py.java2py(jval)._eq(oVal).__nonzero__()) {
+                                return Py.False;
+                            }
+                        }
+                        return Py.True;
+                    } else {
+                        Object oj = other.getJavaProxy();
+                        if (oj instanceof Map) {
+                            Map<Object, Object> oMap = (Map<Object, Object>) oj;
+                            return asMap().equals(oMap) ? Py.True : Py.False;
+                        } else {
+                            return null;
+                        }
+                    }
+                }
+            };
+
             PyBuiltinMethodNarrow mapIterProxy = new MapMethod("__iter__", 0) {
                 @Override
                 public PyObject __call__() {

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


More information about the Jython-checkins mailing list