[Python-Dev] Issue #25256: Add sys.debug_build? (original) (raw)
Serhiy Storchaka storchaka at gmail.com
Fri Oct 2 16:43:56 CEST 2015
- Previous message (by thread): [Python-Dev] Issue #25256: Add sys.debug_build?
- Next message (by thread): [Python-Dev] Summary of Python tracker Issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 02.10.15 10:18, Victor Stinner wrote:
I would like to add an obvious way to check if Python was compiled in debug mode, instead of having hacks/tips to check it. On the Internet, I found various recipes to check if Python is compiled is debug mode. Sadly, some of them are not portable.
I agree with Maciej. Why do you need to check if Python is compiled in debug mode? Because either you need to use some feature that is available only in debug mode (such as sys.gettotalrefcount), or to distinguish debug and non-debug binaries (in sysconfig and distutils), or make the behaviour different in debug mode (in warnings), or handle other behaviour differences (such as additional asserts or different stack consumption). In the first case you should just explicitly check the existence of related function. In the second case I suggest to use sys.abiflags as a suffix (likely you want to distinguish pymalloc from non-pymalloc build), or at least make a suffix depended on sys.abiflags. In the third case perhaps we have to set default warning level depending on sys.flags.debug, or sys.flags.verbose, or other dynamic flags. In the fourth case there is no good solution, but in any case this behaviour is implementation specific, and other implementation can have different consistency checks and different limits.
- Previous message (by thread): [Python-Dev] Issue #25256: Add sys.debug_build?
- Next message (by thread): [Python-Dev] Summary of Python tracker Issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]