summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/bltinmodule.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 8390b7b..144a62f 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -619,7 +619,9 @@ builtin_getattr(PyObject *self, PyObject *args)
return NULL;
}
result = PyObject_GetAttr(v, name);
- if (result == NULL && dflt != NULL) {
+ if (result == NULL && dflt != NULL &&
+ PyErr_ExceptionMatches(PyExc_AttributeError))
+ {
PyErr_Clear();
Py_INCREF(dflt);
result = dflt;