Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Mark Hammond
Greg writes: > Christian Heimes 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. > > Shouldn't it only be catching AttributeError, though? This has come up

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Greg Ewing
I wrote: Shouldn't it only be catching AttributeError, though? Forget that, I forgot that PyObject_HasAttr can't signal an exception. The Py3 C API should be designed to fix this, I think. -- Greg ___ Python-Dev mailing list Python-Dev@python.org

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Greg Ewing
Christian Heimes 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. Shouldn't it only be catching AttributeError, though? We should make sure all code in the core beha

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Benjamin Peterson
On Tue, May 20, 2008 at 6:44 PM, Christian Heimes <[EMAIL PROTECTED]> wrote: > Benjamin Peterson schrieb: >> 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. > > How do you define "fai

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Christian Heimes
Benjamin Peterson schrieb: > 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. How do you define "fail" in this context? Christian ___ Python

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Benjamin Peterson
On Tue, May 20, 2008 at 5:38 PM, Christian Heimes <[EMAIL PROTECTED]> 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 behav

Re: [Python-Dev] disappearing exceptions

2008-05-20 Thread Christian Heimes
Benjamin Peterson schrieb: > In several places in the C code, there are instances where all > exceptions can be completely ignored (akin to a bare except > statement.) after a PyObject_GetAttr call. > > A week ago, I fixed one of these in hasattr (issue 2196) by > propagating exceptions that don't

[Python-Dev] disappearing exceptions

2008-05-20 Thread Benjamin Peterson
In several places in the C code, there are instances where all exceptions can be completely ignored (akin to a bare except statement.) after a PyObject_GetAttr call. A week ago, I fixed one of these in hasattr (issue 2196) by propagating exceptions that don't inherit Exception (SystemExit, Keyboar