> Starting with Python 2.7 and 3.2 you can do this:
>
sysconfig.get_config_var("Py_DEBUG")
> 1
>
> (returns None if the var doesn't exist)
IIRC sysconfig.get_config_var() still depends on parsing the pyconfig.h
file. This won't work on Windows because we are using project and config
setting
On Tue, Jul 27, 2010 at 09:06, John Reid wrote:
> 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.
>
> Thanks,
> John.
Starting with Python 2.7 and 3.2 you can do this:
>>> syscon
> 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
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.
Thanks,
John.
--
http://mail.python.org/mailman/listinfo/python-list