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

STINNER Victor report at bugs.python.org
Thu Dec 19 17:14:53 CET 2013


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() may call Python code (encodings implemented in Python).

Example with gdb (to simulate a CTRL+c during Python startup):

$ gdb ./python
(gdb) b initfsencoding 
(gdb) run
Breakpoint 1, initfsencoding (interp=0x971420) at Python/pythonrun.c:972
(gdb) signal SIGINT
(gdb) cont
Python initialization error: Unable to get the locale encoding
Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 2152, in _find_and_load
KeyboardInterrupt
[Inferior 1 (process 15566) exited with code 01]

The process exited with exit code 1, not with SIGABRT.

----------
keywords: +patch
Added file: http://bugs.python.org/file33215/init_error.patch

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


More information about the Python-bugs-list mailing list