diff options
Diffstat (limited to 'Python')
-rw-r--r-- | Python/bltinmodule.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index 585059f..de3f0f4 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -861,9 +861,13 @@ builtin_hasattr(PyObject *self, PyObject *args) } v = PyObject_GetAttr(v, name); if (v == NULL) { - PyErr_Clear(); - Py_INCREF(Py_False); - return Py_False; + if (!PyErr_ExceptionMatches(PyExc_Exception)) + return NULL; + else { + PyErr_Clear(); + Py_INCREF(Py_False); + return Py_False; + } } Py_DECREF(v); Py_INCREF(Py_True); |