mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
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
This commit is contained in:
parent
f3175f6341
commit
45aecf451a
24 changed files with 87 additions and 6365 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue