mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Merged revisions 72690 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r72690 | benjamin.peterson | 2009-05-16 16:44:25 -0500 (Sat, 16 May 2009) | 1 line properly lookup __instancecheck__ and __subclasscheck__ ........
This commit is contained in:
parent
188789d8f4
commit
88fe5f9776
3 changed files with 25 additions and 39 deletions
|
@ -2574,14 +2574,8 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls)
|
|||
Py_LeaveRecursiveCall();
|
||||
return r;
|
||||
}
|
||||
if (name == NULL) {
|
||||
name = PyUnicode_InternFromString("__instancecheck__");
|
||||
if (name == NULL)
|
||||
return -1;
|
||||
}
|
||||
checker = PyObject_GetAttr(cls, name);
|
||||
if (checker == NULL && PyErr_Occurred())
|
||||
PyErr_Clear();
|
||||
|
||||
checker = _PyObject_LookupSpecial(cls, "__instancecheck__", &name);
|
||||
if (checker != NULL) {
|
||||
PyObject *res;
|
||||
int ok = -1;
|
||||
|
@ -2644,14 +2638,8 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls)
|
|||
Py_LeaveRecursiveCall();
|
||||
return r;
|
||||
}
|
||||
if (name == NULL) {
|
||||
name = PyUnicode_InternFromString("__subclasscheck__");
|
||||
if (name == NULL)
|
||||
return -1;
|
||||
}
|
||||
PyErr_Fetch(&t, &v, &tb);
|
||||
checker = PyObject_GetAttr(cls, name);
|
||||
PyErr_Restore(t, v, tb);
|
||||
|
||||
checker = _PyObject_LookupSpecial(cls, "__subclasscheck__", &name);
|
||||
if (checker != NULL) {
|
||||
PyObject *res;
|
||||
int ok = -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue