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?
Austin On Fri, Jan 29, 2010 at 9:04 PM, Gabriel Genellina <gagsl-...@yahoo.com.ar> wrote: > En Fri, 29 Jan 2010 11:37:09 -0300, Austin Bingham > <austin.bing...@gmail.com> escribió: > >> I've noticed that several (many?) python functions seem to clear the >> error/exception indicators when they're called from a C/C++ program. >> For example, both PyImport_ImportModule and traceback.extract_tb() >> (called via the function call methods) do this: if error indicators >> are set prior to their call (as indicated by PyErr_Fetch, and >> including a call to PyErr_Restore), I see that they are unset (using >> the same method) after the call. This happens even when the functions >> succeed. > > It's simple: you have to check *every* function call for failure. Many > functions return new object references and you have to properly decrement > them in case of failure, so in most cases this means that you have to check > each and every call. > > -- > Gabriel Genellina > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list