[Jython-checkins] jython: Ignore old style classes for instancecheck/subclasscheck. Fixes test_typechecks

frank.wierzbicki jython-checkins at python.org
Wed Apr 4 20:39:33 CEST 2012


http://hg.python.org/jython/rev/df14a2f59dc5
changeset:   6530:df14a2f59dc5
user:        Frank Wierzbicki <fwierzbicki at gmail.com>
date:        Wed Apr 04 11:39:10 2012 -0700
summary:
  Ignore old style classes for instancecheck/subclasscheck. Fixes test_typechecks

files:
  src/org/python/core/Py.java |  7 ++++++-
  1 files changed, 6 insertions(+), 1 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
@@ -2024,7 +2024,7 @@
 
     /**
      * Attempt to dispatch an isinstance/issubclass call to cls's associated
-     * __instance/subclasscheck__.
+     * __instancecheck__/__subclasscheck__.
      *
      * @param checkerArg the argument to call the checker with
      * @param cls a Python class
@@ -2034,6 +2034,11 @@
      */
     private static PyObject dispatchToChecker(PyObject checkerArg, PyObject cls,
                                               String checkerName) {
+        //Ignore old style classes.
+        if (cls instanceof PyClass) {
+            return null;
+        }
+
         PyObject checker = cls.__findattr__(checkerName);
         if (checker == null) {
             return null;

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


More information about the Jython-checkins mailing list