From: <zy...@us...> - 2009-04-16 06:18:48
|
Revision: 6231 http://jython.svn.sourceforge.net/jython/?rev=6231&view=rev Author: zyasoft Date: 2009-04-16 06:18:40 +0000 (Thu, 16 Apr 2009) Log Message: ----------- Fixed JavaImportHelper#getFromListAsStrings, which was assuming that the PyTuple it was iterating over would contain String, not PyString. Now allow both, just in case, since either should be applicable anyway. Modified Paths: -------------- branches/newlist/src/org/python/core/JavaImportHelper.java branches/newlist/src/org/python/core/PyList.java branches/newlist/src/org/python/core/packagecache/PackageManager.java Modified: branches/newlist/src/org/python/core/JavaImportHelper.java =================================================================== --- branches/newlist/src/org/python/core/JavaImportHelper.java 2009-04-16 05:48:35 UTC (rev 6230) +++ branches/newlist/src/org/python/core/JavaImportHelper.java 2009-04-16 06:18:40 UTC (rev 6231) @@ -120,6 +120,9 @@ Iterator iterator = ((PyTuple) fromlist).iterator(); while (iterator.hasNext()) { Object obj = iterator.next(); + if (obj instanceof PyString) { + obj = ((PyString)obj).string; + } if (obj instanceof String) { String fromName = (String) obj; if (!"*".equals(fromName)) { Modified: branches/newlist/src/org/python/core/PyList.java =================================================================== --- branches/newlist/src/org/python/core/PyList.java 2009-04-16 05:48:35 UTC (rev 6230) +++ branches/newlist/src/org/python/core/PyList.java 2009-04-16 06:18:40 UTC (rev 6231) @@ -142,7 +142,7 @@ value = new PyList(value); setsliceIterator(start, stop, step, value.asIterable().iterator()); } else { - System.err.println("List"); +// System.err.println("List"); List valueList = (List) value.__tojava__(List.class); if (valueList != null && valueList != Py.NoConversion) { setsliceList(start, stop, step, valueList); Modified: branches/newlist/src/org/python/core/packagecache/PackageManager.java =================================================================== --- branches/newlist/src/org/python/core/packagecache/PackageManager.java 2009-04-16 05:48:35 UTC (rev 6230) +++ branches/newlist/src/org/python/core/packagecache/PackageManager.java 2009-04-16 06:18:40 UTC (rev 6231) @@ -88,11 +88,9 @@ if (!instantiate) { PyList ret = cls.keys(); - PyList dictKeys = dict.keys(); - for (int i = 0; i < dictKeys.__len__(); i++) { - PyObject name = dictKeys.pyget(i); + for (PyObject name : dictKeys.asIterable()) { if (!cls.has_key(name)) { if (exclpkgs && dict.get(name) instanceof PyJavaPackage) continue; @@ -103,7 +101,6 @@ return ret; } - for (PyObject pyname : cls.keys().asIterable()) { if (!dict.has_key(pyname)) { String name = pyname.toString(); @@ -118,8 +115,7 @@ * Helper merging list2 into list1. Returns list1. */ protected PyList merge(PyList list1, PyList list2) { - for (int i = 0; i < list2.__len__(); i++) { - PyObject name = list2.pyget(i); + for (PyObject name : list2.asIterable()) { list1.append(name); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |