Debugging & Profiling

faulthandler — Dump the Python traceback

This module contains functions to dump Python tracebacks explicitly, on a fault, after a timeout, or on a user signal. Call faulthandler.enable() to install fault handlers for the SIGSEGV, SIGFPE, SIGABRT, SIGBUS, and SIGILL signals. You can also enable them at startup by setting the PYTHONFAULTHANDLER environment variable or by using the -X faulthandler command line option.

bdb — Debugger framework

Source code: Lib/

Audit events table

This table contains all events raised by sys.audit() or PySys_Audit() calls throughout the CPython runtime and the standard library. These calls were added in 3.8.0 or later.

pdb — The Python Debugger

Source code: Lib/

The Python Profilers

Source code: Lib/ and Lib/

trace — Trace or track Python statement execution

Source code: Lib/

tracemalloc — Trace memory allocations

Source code: Lib/

timeit — Measure execution time of small code snippets

Source code: Lib/