diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-05-16 21:55:24 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-05-16 21:55:24 (GMT) |
commit | 88fe5f9776bca1dee330a76776f831e12ea8b36d (patch) | |
tree | f7c1eecb1fdde9693dcb13a68fa0509b9010c8b3 /Objects/abstract.c | |
parent | 188789d8f445f9d7a4885025a7885b0f50c593a6 (diff) | |
download | cpython-88fe5f9776bca1dee330a76776f831e12ea8b36d.zip cpython-88fe5f9776bca1dee330a76776f831e12ea8b36d.tar.gz cpython-88fe5f9776bca1dee330a76776f831e12ea8b36d.tar.bz2 |
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__
........
Diffstat (limited to 'Objects/abstract.c')
-rw-r--r-- | Objects/abstract.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/Objects/abstract.c b/Objects/abstract.c index cc125f5..ae536a7 100644 --- a/Objects/abstract.c +++ b/Objects/abstract.c @@ -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; |