STINNER Victor <victor.stin...@haypocalc.com> added the comment: Version 11 of my patch: - Disable the fault handler (and displaying the backtrace on a fatal error) by default - The fault handle can be enabled by setting the PYTHONFAULTHANDLER environment variable or using "-X faulthandler" command line option (instead of being disabled by setting the PYTHONNOFAULTHANDLER env var) - Use PyGILState_GetThisThreadState() instead of _Py_atomic_load_relaxed(&_PyThreadState_Current) to get the state of the current thread, especially if the current thread doesn't hold the GIL - Add a protection against recursive calls to _Py_DisplayBacktrace() (a recursive call does nothing), even it is very unlikely - Don't repeat the exception message after the backtrace - Add a test on a segfault in a thread not holding the GIL
Disable the fault handler by default solves many issues reported on the python-dev mailing list: - Issues with embedded Python - Python 3.2 beta 2 is released - The fault handler supposes that the file descriptor 2 is the standard error output, but it may be a critical file or a network socket Amaury asked for a sys.setsegfaultenabled() option: I think that the command line option and the environment variable are enough. The question is now how to enable the feature for a single run (reproduce a crash to try to get more information), not how to enable/disable it system-wide (because most developers agree that it should be disabled by default). Should it be backported to Python 2.7 and 3.1? ---------- Added file: http://bugs.python.org/file20144/segfault_handler-11.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue8863> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com