mirror of
https://github.com/python/cpython.git
synced 2025-11-26 21:33:10 +00:00
Remove unnecessary traceback save/restore pair.
This commit is contained in:
parent
27f60a65e8
commit
c71d2a9afd
1 changed files with 2 additions and 4 deletions
|
|
@ -2907,22 +2907,20 @@ int
|
|||
PyObject_IsInstance(PyObject *inst, PyObject *cls)
|
||||
{
|
||||
static PyObject *name = NULL;
|
||||
PyObject *t, *v, *tb;
|
||||
PyObject *checker;
|
||||
|
||||
/* Quick test for an exact match */
|
||||
if (Py_TYPE(inst) == (PyTypeObject *)cls)
|
||||
return 1;
|
||||
|
||||
PyErr_Fetch(&t, &v, &tb);
|
||||
|
||||
if (name == NULL) {
|
||||
name = PyString_InternFromString("__instancecheck__");
|
||||
if (name == NULL)
|
||||
return -1;
|
||||
}
|
||||
checker = PyObject_GetAttr(cls, name);
|
||||
PyErr_Restore(t, v, tb);
|
||||
if (checker == NULL && PyErr_Occurred())
|
||||
PyErr_Clear();
|
||||
if (checker != NULL) {
|
||||
PyObject *res;
|
||||
int ok = -1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue