[issue19983] Ctrl-C at startup can end in a Py_FatalError call

2013-12-19 Thread STINNER Victor
STINNER Victor added the comment: init_error.patch: modify Py_Initialize() to exit with exit(1) instead of abort(), to not call the sytem fault handler (ex: dump a coredump on Linux, or open a popup on Windows). The patch calls also initsigs() before initfsencoding(), because initfsencoding()

[issue19983] Ctrl-C at startup can end in a Py_FatalError call

2013-12-16 Thread STINNER Victor
STINNER Victor added the comment: > BTW: Why can't we make this an official API function, e.g. Py_Terminate() ? Exiting Python immediatly is bad practice, there is already Py_FatalError() for that. Instead of adding a second public function, I would prefer to remove most calls to Py_FatalErro

[issue19983] Ctrl-C at startup can end in a Py_FatalError call

2013-12-16 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 16.12.2013 10:30, STINNER Victor wrote: > > STINNER Victor added the comment: > > 2013/12/16 Marc-Andre Lemburg : >> I don't think changing Py_FatalError() is a good idea. However, >> its use in this particular case (streams not initializing) appears >>

[issue19983] Ctrl-C at startup can end in a Py_FatalError call

2013-12-16 Thread STINNER Victor
STINNER Victor added the comment: 2013/12/16 Marc-Andre Lemburg : > I don't think changing Py_FatalError() is a good idea. However, > its use in this particular case (streams not initializing) appears > wrong. > > Python should simply exit with an error code in such a case; which then > also allo

[issue19983] Ctrl-C at startup can end in a Py_FatalError call

2013-12-16 Thread Marc-Andre Lemburg
Marc-Andre Lemburg added the comment: On 16.12.2013 10:02, STINNER Victor wrote: > > Maybe we should modify Py_FatalError() to call exit(1) in release mode, and > only call abort() in debug mode? Dumping a core dump, opening a Windows fatal > error popup, calling Fedora ABRT handler, etc. is m

[issue19983] Ctrl-C at startup can end in a Py_FatalError call

2013-12-16 Thread STINNER Victor
STINNER Victor added the comment: I modified initstdio() to add raise(SIGINT); at the beginning of the function. I get: $ ./python Fatal Python error: Py_Initialize: can't initialize sys standard streams Traceback (most recent call last): File "", line 2157, in _find_and_load KeyboardInterrup

[issue19983] Ctrl-C at startup can end in a Py_FatalError call

2013-12-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ah, ok. So it's a controlled crash: Python fails initializing the standard streams and so it decides to bail out (by using Py_FatalError, since Py_Initialize doesn't return an error code). What we could do is call initsigs() after initstdio() (but still before