[issue6498] Py_Main() does not return on SystemExit

Rogi report at bugs.python.org
Tue Mar 29 02:10:08 CEST 2011


Rogi <rogi at linuxmail.org> added the comment:

@mhammond

	Maybe its just me but it seems to be a really bad idea to let
those functions terminate your process as they wish. Teh programmer
should be allowed to control teh flow of his application.

	However, I am not teh only one affected by this. I recall seeing
blender crash when I typed raise(SystemExit) on its interactive console.
Teh new blender beta worked around this by UNDEFINING SystemExit, which,
to me, seems a UGLY HACK.

	If backwards compatibility is teh problem, things could still be
hacked to maintain it and achieve teh desired behaviour during
transition. For example, one could set a macro GOOD_BEHAVING_PYTHON and
obtain teh desired behaviour, without breaking old stuff. It's ugly but
it works.

	Teh new behaviour could be something liek that:

	...
	#define GOOD_BEHAVING_PYTHON 1
	#include <Python.h>
	...
	PyRun_SimpleString(...);

	/* allow programmer to do what he wants */

	/* if he wants to, he can do teh following */
	PyErr_Print();
	PyErr_Handle();
	...

this way, Py_Main() could be implemented in a way it would return to its
caller instead of terminating teh process.

	Adn about my keyboadr, its not juts teh 'h' adn 'e' keys.

Cheers.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6498>
_______________________________________


More information about the Python-bugs-list mailing list