mirror of
https://github.com/python/cpython.git
synced 2025-11-27 13:45:25 +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)
|
PyObject_IsInstance(PyObject *inst, PyObject *cls)
|
||||||
{
|
{
|
||||||
static PyObject *name = NULL;
|
static PyObject *name = NULL;
|
||||||
PyObject *t, *v, *tb;
|
|
||||||
PyObject *checker;
|
PyObject *checker;
|
||||||
|
|
||||||
/* Quick test for an exact match */
|
/* Quick test for an exact match */
|
||||||
if (Py_TYPE(inst) == (PyTypeObject *)cls)
|
if (Py_TYPE(inst) == (PyTypeObject *)cls)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
PyErr_Fetch(&t, &v, &tb);
|
|
||||||
|
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
name = PyString_InternFromString("__instancecheck__");
|
name = PyString_InternFromString("__instancecheck__");
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
checker = PyObject_GetAttr(cls, name);
|
checker = PyObject_GetAttr(cls, name);
|
||||||
PyErr_Restore(t, v, tb);
|
if (checker == NULL && PyErr_Occurred())
|
||||||
|
PyErr_Clear();
|
||||||
if (checker != NULL) {
|
if (checker != NULL) {
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
int ok = -1;
|
int ok = -1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue