SF patch #471852 (anonymous) notes that getattr(obj, name, default)
masks any exception, not just AttributeError. Fix this.
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 @@
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;