Configure Python — Debug options

Build Python in debug mode : define the Py_DEBUG macro (disabled by default).

Enable tracing references for debugging purpose (disabled by default).

Define the Py_TRACE_REFS macro. Add sys.getobjects function. Add PYTHONDUMPREFS environment variable.

The PYTHONDUMPREFS environment variable can be used to dump objects and reference counts still alive at Python exit.

Statically allocated objects are not traced.

Build with C assertions enabled (default is no): assert(...); and _PyObject_ASSERT(...);.

If set, the NDEBUG macro is not defined in the OPT compiler variable.

See also the --with-pydebug option (debug build ) which also enables assertions.

Enable Valgrind support (default is no).

Enable DTrace support (default is no).

See Instrumenting CPython with DTrace and SystemTap .

Enable AddressSanitizer memory error detector, asan (default is no). To improve ASan detection capabilities you may also want to combine this with --without-pymalloc to disable the specialized small-object allocator whose allocations are not tracked by ASan.

Enable MemorySanitizer allocation error detector, msan (default is no).

Enable UndefinedBehaviorSanitizer undefined behaviour detector, ubsan (default is no).

Enable ThreadSanitizer data race detector, tsan (default is no).