Some C-API functions clear the error indicator?

Austin Bingham austin.bingham at
Sat Jan 30 08:10:39 CET 2010

The original post was, in a nutshell, the "use case"; it's very scaled
down the from the real example, and not intended to "make sense". The
notion on which I was (apparently incorrectly) basing my exception
translation was that I could 1) get and reset references to the error
indicators, 2) call other python methods that don't themselves throw,
and 3) later retrieve the same "active" exceptions. I was relying on
this ability to "re-fetch" exceptions insofar as the functions in my
code which dealt with python exceptions all looked up the exception
separately. The predicate that "a successful function won't modify the
error indicators" appears to be wrong, however, and I've modified my
code accordingly.


On Sat, Jan 30, 2010 at 1:11 AM, Gabriel Genellina
<gagsl-py2 at> wrote:
> En Fri, 29 Jan 2010 18:25:14 -0300, Austin Bingham
> <austin.bingham at> escribió:
>> Maybe I'm not following what you're saying. In my case, I already know
>> that an exception has been thrown. In the course of processing that
>> exception, I call another function which, for whatever reason and even
>> when it succeeds, clears the exception indicators. How can I address
>> this issue by checking function calls for failure?
> Maybe if you provide an actual use case we can suggest how to handle it. The
> code in your original post does not make any sense to me (except by showing
> that PyImport_ImportModule does clear the error indicator). If you already
> know there was an error, and you even have retrieved the error details, why
> do you care if the error indicator gets reset?
> --
> Gabriel Genellina
> --

More information about the Python-list mailing list