
May 20, 2008
4:25 p.m.
On Tue, May 20, 2008 at 5:38 PM, Christian Heimes <lists@cheimes.de> wrote:
Thankfully this issue was fixed in Python 2.6 and 3.0. In newer versions of Python hasattr() only swallows exception based on the Exception class but not BaseExceptions. We should make sure all code in the core behaves the same way. Exceptions based on BaseException must *never* be swallowed. The behavior may even be worse a macro and it should be documented in large, friendly and red letters in the C API docs. *wink*
Speaking of the C-API, I was thinking of introducing a new function called PyObject_SafeHasAttr that functions just like PyObject_HasAttr except it can fail.
Christian
-- Cheers, Benjamin Peterson "There's no place like 127.0.0.1."