README.rst 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. +++++++++++++
  2. Fault handler
  3. +++++++++++++
  4. .. image:: https://img.shields.io/pypi/v/faulthandler.svg
  5. :alt: Latest release on the Python Cheeseshop (PyPI)
  6. :target: https://pypi.python.org/pypi/faulthandler
  7. .. image:: https://travis-ci.org/vstinner/faulthandler.svg?branch=master
  8. :alt: Build status of faulthandler on Travis CI
  9. :target: https://travis-ci.org/vstinner/faulthandler
  10. .. image:: http://unmaintained.tech/badge.svg
  11. :target: http://unmaintained.tech/
  12. :alt: No Maintenance Intended
  13. Fault handler for SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL signals: display
  14. the Python traceback and restore the previous handler. Allocate an alternate
  15. stack for this handler, if sigaltstack() is available, to be able to allocate
  16. memory on the stack, even on stack overflow (not available on Windows).
  17. Import the module and call faulthandler.enable() to enable the fault handler.
  18. Alternatively you can set the PYTHONFAULTHANDLER environment variable to a
  19. non-empty value.
  20. The fault handler is called on catastrophic cases and so it can only use
  21. signal-safe functions (eg. it doesn't allocate memory on the heap). That's why
  22. the traceback is limited: it only supports ASCII encoding (use the
  23. backslashreplace error handler for non-ASCII characters) and limits each string
  24. to 100 characters, doesn't print the source code in the traceback (only the
  25. filename, the function name and the line number), is limited to 100 frames and
  26. 100 threads.
  27. By default, the Python traceback is written to the standard error stream. Start
  28. your graphical applications in a terminal and run your server in foreground to
  29. see the traceback, or pass a file to faulthandler.enable().
  30. faulthandler is implemented in C using signal handlers to be able to dump a
  31. traceback on a crash or when Python is blocked (eg. deadlock).
  32. This module is the backport for CPython 2.7. faulthandler is part of CPython
  33. standard library since CPython 3.3: `faulthandler
  34. <http://docs.python.org/dev/library/faulthandler.html>`_. For PyPy,
  35. faulthandler is builtin since PyPy 5.5: use ``pypy -X faulthandler``.
  36. Website:
  37. https://faulthandler.readthedocs.io/
  38. faulthandler 3.2 is the last version released by Victor Stinner. I maintained
  39. it for 10 years in my free time for the great pleasure of Python 2 users, but
  40. Python 2 is no longer supported upstream since 2020-01-01. Each faulthandler
  41. release requires me to start my Windows VM, install Python 2.7 in 32-bit and
  42. 64-bit, install an old C compiler just for Python 2.7, and type manually some
  43. commands to upload Windows binaries. Moreover, I have to fix some issues on
  44. Travis CI and many small boring tasks. The maintenance is far from being free.
  45. In 10 years, I got zero "thank you" (and 0€), only bug reports :-)