diff options
author | Guido van Rossum <guido@python.org> | 2001-10-16 21:31:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-10-16 21:31:32 (GMT) |
commit | d892357bf7bfb8ce34a0652c7002d78bbce17b6e (patch) | |
tree | 9519730eaaddc6f2bd13d3bb16ad98cbc2e7e861 /Python/bltinmodule.c | |
parent | 9bc9d66eb1fed286693154405cc4c18626eff09e (diff) | |
download | cpython-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.c | 4 |
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; |