Check in interpreter if running a debug version of python

Christian Heimes lists at cheimes.de
Tue Jul 27 10:25:44 EDT 2010


> Can I check in the interpreter if I am running a debug version of 
> python? I don't mean if __debug__ is set, I want to know if python was 
> compiled in debug mode.

Python has multiple flavors of debug builds. hasattr(sys,
"gettotalrefcount") is only available if Py_REF_DEBUG is enabled. This
should be sufficient to detect the most used debug variant.

Christian





More information about the Python-list mailing list