[prev in list] [next in list] [prev in thread] [next in thread]
List: python-dev
Subject: Re: [Python-Dev] Issue #25256: Add sys.debug_build?
From: Serhiy Storchaka <storchaka () gmail ! com>
Date: 2015-10-02 14:43:56
Message-ID: mum57d$o33$1 () ger ! gmane ! org
[Download RAW message or body]
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.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: https://mail.python.org/mailman/options/python-dev/python-dev-marcsub-zyf4%40marc.info
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic