summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-16 21:31:32 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-16 21:31:32 (GMT)
commitd892357bf7bfb8ce34a0652c7002d78bbce17b6e (patch)
tree9519730eaaddc6f2bd13d3bb16ad98cbc2e7e861 /Python/bltinmodule.c
parent9bc9d66eb1fed286693154405cc4c18626eff09e (diff)
downloadcpython-d892357bf7bfb8ce34a0652c7002d78bbce17b6e.zip
cpython-d892357bf7bfb8ce34a0652c7002d78bbce17b6e.tar.gz
cpython-d892357bf7bfb8ce34a0652c7002d78bbce17b6e.tar.bz2
SF patch #471852 (anonymous) notes that getattr(obj, name, default)
masks any exception, not just AttributeError. Fix this.
Diffstat (limited to 'Python/bltinmodule.c')
-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;