diff options
| author | Guido van Rossum <guido@python.org> | 2001-10-16 21:31:32 +0000 |
|---|---|---|
| committer | Guido van Rossum <guido@python.org> | 2001-10-16 21:31:32 +0000 |
| commit | d892357bf7bfb8ce34a0652c7002d78bbce17b6e (patch) | |
| tree | 9519730eaaddc6f2bd13d3bb16ad98cbc2e7e861 /Python | |
| parent | 9bc9d66eb1fed286693154405cc4c18626eff09e (diff) | |
| download | cpython-git-d892357bf7bfb8ce34a0652c7002d78bbce17b6e.tar.gz | |
SF patch #471852 (anonymous) notes that getattr(obj, name, default)
masks any exception, not just AttributeError. Fix this.
Diffstat (limited to 'Python')
| -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 8390b7b80b..144a62f920 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; |
