On 28/03/2011 5:28 AM, Eric Frederich wrote:
I'm not talking about the documentation for sys.exit()
I'm talking about the documentation for Py_Main(int argc, char **argv)
http://docs.python.org/c-api/veryhigh.html?highlight=py_main#Py_Main
This C function never returns anything whether in the interpreter I
type "exit(123)" or "sys.exit(123)".
I cannot call any of my C cleanup code because of this.
I think there is a bug in that documentation - the paragraph:
Note that if an otherwise unhandled SystemError is raised, this
function will not return 1, but exit the process, as long as
Py_InspectFlag is not set.
Looks like it should refer to SystemExit, not SystemError. If you check
out pythonrun.c in handle_system_exit, you will note the behaviour
described above is exactly what is implemented for SystemExit.
See also http://bugs.python.org/issue6498
HTH,
Mark.
--
http://mail.python.org/mailman/listinfo/python-list