From: John Reid on 27 Jul 2010 10:06 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.
From: Christian Heimes on 27 Jul 2010 10:25 > 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
From: Christian Heimes on 27 Jul 2010 11:18 > 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 settings of VisualStudio.
|
Pages: 1 Prev: string manipulation. Next: Why is there no platform independent way of clearing aterminal? |