diff options
author | Guido van Rossum <guido@python.org> | 2006-03-15 04:58:47 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-03-15 04:58:47 (GMT) |
commit | 45aecf451a64fb1ebe5e74d0b00965ac8d99dff6 (patch) | |
tree | a7edcfb45ceafcffde68a3542aeba67089ea81cb /Objects | |
parent | f3175f6341ae207543a0d2d3be36c457349066e6 (diff) | |
download | cpython-45aecf451a64fb1ebe5e74d0b00965ac8d99dff6.zip cpython-45aecf451a64fb1ebe5e74d0b00965ac8d99dff6.tar.gz cpython-45aecf451a64fb1ebe5e74d0b00965ac8d99dff6.tar.bz2 |
Checkpoint. 218 tests are okay; 53 are failing. Done so far:
- all classes are new-style (but ripping out classobject.[ch] isn't done)
- int/int -> float
- all exceptions must derive from BaseException
- absolute import
- 'as' and 'with' are keywords
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/abstract.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index 399656f..052e3ca 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -2106,12 +2106,7 @@ recursive_isinstance(PyObject *inst, PyObject *cls, int recursion_depth) return -1; } - if (PyClass_Check(cls) && PyInstance_Check(inst)) { - PyObject *inclass = - (PyObject*)((PyInstanceObject*)inst)->in_class; - retval = PyClass_IsSubclass(inclass, cls); - } - else if (PyType_Check(cls)) { + if (PyType_Check(cls)) { retval = PyObject_TypeCheck(inst, (PyTypeObject *)cls); if (retval == 0) { PyObject *c = PyObject_GetAttr(inst, __class__); @@ -2177,7 +2172,7 @@ recursive_issubclass(PyObject *derived, PyObject *cls, int recursion_depth) { int retval; - if (!PyClass_Check(derived) || !PyClass_Check(cls)) { + { if (!check_class(derived, "issubclass() arg 1 must be a class")) return -1; @@ -2212,11 +2207,6 @@ recursive_issubclass(PyObject *derived, PyObject *cls, int recursion_depth) retval = abstract_issubclass(derived, cls); } - else { - /* shortcut */ - if (!(retval = (derived == cls))) - retval = PyClass_IsSubclass(derived, cls); - } return retval; } |