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

Reply via email to