summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 02a2faa..0234b6b 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -877,9 +877,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);