[Jython-checkins] jython (merge 2.5 -> default): Merge 2.5.
frank.wierzbicki
jython-checkins at python.org
Fri Apr 6 23:28:11 CEST 2012
http://hg.python.org/jython/rev/e8d6b764cb10
changeset: 6543:e8d6b764cb10
parent: 6541:5a9128b6662b
parent: 6542:196e2e8bad7b
user: Frank Wierzbicki <fwierzbicki at gmail.com>
date: Fri Apr 06 14:27:06 2012 -0700
summary:
Merge 2.5.
files:
src/org/python/core/Py.java | 23 +++++++++++++++++++++--
1 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/src/org/python/core/Py.java b/src/org/python/core/Py.java
--- a/src/org/python/core/Py.java
+++ b/src/org/python/core/Py.java
@@ -1929,8 +1929,15 @@
return inClass.isSubClass((PyClass) cls);
}
if (cls instanceof PyType) {
+ PyType type = (PyType)cls;
+
+ //Special case PyStringMap to compare as an instance type dict.
+ if (inst instanceof PyStringMap &&
+ type.equals(PyDictionary.TYPE)) {
+ return true;
+ }
+
PyType instType = inst.getType();
- PyType type = (PyType) cls;
// equiv. to PyObject_TypeCheck
if (instType == type || instType.isSubType(type)) {
@@ -1981,7 +1988,19 @@
if (derived == cls) {
return true;
}
- return ((PyType) derived).isSubType((PyType) cls);
+ PyType type = (PyType)cls;
+ PyType subtype = (PyType)derived;
+
+ // Special case PyStringMap to compare as a subclass of
+ // PyDictionary. Note that we don't need to check for stringmap
+ // subclasses, since stringmap can't be subclassed. PyStringMap's
+ // TYPE is computed lazily, so we have to use PyType.fromClass :(
+ if (type == PyDictionary.TYPE &&
+ subtype == PyType.fromClass(PyStringMap.class)) {
+ return true;
+ }
+
+ return subtype.isSubType(type);
}
if (derived instanceof PyClass && cls instanceof PyClass) {
return ((PyClass) derived).isSubClass((PyClass) cls);
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list