[Jython-checkins] jython: Register java.util.{List,Map,Set} with ABCs without namespace issues

jim.baker jython-checkins at python.org
Fri Sep 26 19:44:20 CEST 2014


https://hg.python.org/jython/rev/9fef5da411e5
changeset:   7394:9fef5da411e5
user:        Jim Baker <jim.baker at rackspace.com>
date:        Fri Sep 26 11:43:55 2014 -0600
summary:
  Register java.util.{List,Map,Set} with ABCs without namespace issues

files:
  Lib/_abcoll.py |  18 +++++++++++-------
  1 files changed, 11 insertions(+), 7 deletions(-)


diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -19,7 +19,6 @@
            "Sequence", "MutableSequence",
            ]
 
-_is_jython = sys.platform.startswith("java")
 
 ### ONE-TRICK PONIES ###
 
@@ -602,12 +601,17 @@
 
 MutableSequence.register(list)
 
-if _is_jython:
+if sys.platform.startswith("java"):
     from org.python.core import PyFastSequenceIter
-    import java
+    # the only name conflict is with Set, but be consistent
+    from java.util import List as JList, Map as JMap, Set as JSet
 
-    MutableSequence.register(java.util.List)
-    MutableMapping.register(java.util.Map)
-    MutableSet.register(java.util.Set)
+    MutableSequence.register(JList)
+    MutableMapping.register(JMap)
+    MutableSet.register(JSet)
     Iterator.register(PyFastSequenceIter)
-
+    
+    del PyFastSequenceIter
+    del JList
+    del JMap
+    del JSet

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


More information about the Jython-checkins mailing list