[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2016-03-25 Thread STINNER Victor

STINNER Victor added the comment:

I lost interest in this issue. It really looks like a corner case, so I prefer 
to keep the current code. I'm not interested to work on the abiflags on Windows.

--
resolution:  -> out of date
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2016-01-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Implementing sys.abiflags on Windows looks more general solution, and it 
doesn't increase the complexity of the stdlib.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2016-01-01 Thread STINNER Victor

STINNER Victor added the comment:

The consensus was to add a new flag to sys.implementation.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2015-12-31 Thread Ezio Melotti

Ezio Melotti added the comment:

If there is consensus about adding this to sys, then the latest patch LGTM 
(module a couple of unaddressed comments on Rietveld).
If not, you should probably bring this up to python-dev.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2015-10-01 Thread Berker Peksag

Berker Peksag added the comment:

LGTM

> Alternative: Add a new sys.implementation.debug_build flag.

According to the sys.implementation documentation and PEP 421, we can only add 
a private attribute without writing a PEP. But I find 
sys.implementation._debug_build too long and ``from sys import implementation; 
implementation._debug_build``(or ``from sys import implementation as i; 
i._debug_build``) is also not easy to write. So I'm +1 to sys.debug_build.

I left two trivial review comments on Rietveld.

--
nosy: +berker.peksag
stage: patch review -> commit review

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2015-10-01 Thread STINNER Victor

STINNER Victor added the comment:

> I don't like this. The sys module is one of most used module, but it has too 
> many members, and adding yet one makes the situation worse.

Hum, what is the problem of adding a symbol? How does it make the module less 
usable?

> Checking for debug mode is not often needed, and mainly in tests.

My patch changes distutils, sysconfig and warnings modules, I agree that other 
changes are only in tests.

>  Current way ``hasattr(sys, 'gettotalrefcount')`` works good.

For me it looks more like an hack than a reliable check.

> You also can check ``'d' in sys.abiflags`` if it looks cleaner to you.

For me, it doesn't look correct to have various ways to check if python was 
compiled in debug mode. It doesn't look portable neither. I prefer to use a 
flag which works on any version of Python (>= 3.6) and any implementation of 
Python.

I don't think that PyPy wants to implement sys.gettotalrefcount() for example, 
but PyPy may want to mimick CPython when it's compiled in debug mode. For 
example, display warnings by default in debug mode.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2015-10-01 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I don't like this. The sys module is one of most used module, but it has too 
many members, and adding yet one makes the situation worse.

>>> len(dir(sys))
81

Checking for debug mode is not often needed, and mainly in tests. Current way 
``hasattr(sys, 'gettotalrefcount')`` works good. You also can check ``'d' in 
sys.abiflags`` if it looks cleaner to you. Or add a member to test.support.

--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2015-10-01 Thread STINNER Victor

STINNER Victor added the comment:

FYI the sys module has 5 more symbols when CPython is compiled in debug mode:

* getobjects()
* gettotalrefcount()
* last_traceback, last_type, last_value

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue25256] Add sys.debug_build public variable to check if Python was compiled in debug mode

2015-10-01 Thread STINNER Victor

STINNER Victor added the comment:

>> You also can check ``'d' in sys.abiflags`` if it looks cleaner to you.

> For me, it doesn't look correct to have various ways to check if python was 
> compiled in debug mode. It doesn't look portable neither. (...)

Oops, I didn't notice that sys.abiflags is not available on Windows!

It's the same issue with 2 solutions to this question:

http://stackoverflow.com/questions/646518/python-how-to-detect-debug-interpreter

* Checking for '_d.pyd' in imp.get_suffixes() => specific to Windows
* sys.executable.endswith("_d.exe") => again, specific to Windows :-(

That's part of my rationale in my first message, we need a portable and 
reliable flag to check if Python was compiled in debug mode.

By the way, the StackOverflow question comes from an user who is probably not 
writing a test, but an application. It means that the flag is also helpful to 
final users.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com