[Python-checkins] CVS: python/dist/src/Python bltinmodule.c,2.240,2.241
Guido van Rossum
gvanrossum@users.sourceforge.net
Tue, 16 Oct 2001 14:31:34 -0700
Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv3352
Modified Files:
bltinmodule.c
Log Message:
SF patch #471852 (anonymous) notes that getattr(obj, name, default)
masks any exception, not just AttributeError. Fix this.
Index: bltinmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/bltinmodule.c,v
retrieving revision 2.240
retrieving revision 2.241
diff -C2 -d -r2.240 -r2.241
*** bltinmodule.c 2001/10/07 20:54:12 2.240
--- bltinmodule.c 2001/10/16 21:31:32 2.241
***************
*** 620,624 ****
}
result = PyObject_GetAttr(v, name);
! if (result == NULL && dflt != NULL) {
PyErr_Clear();
Py_INCREF(dflt);
--- 620,626 ----
}
result = PyObject_GetAttr(v, name);
! if (result == NULL && dflt != NULL &&
! PyErr_ExceptionMatches(PyExc_AttributeError))
! {
PyErr_Clear();
Py_INCREF(dflt);