Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve detection of debug builds on Windows #194

Closed
chrahunt opened this issue Sep 3, 2019 · 0 comments

Comments

@chrahunt
Copy link
Member

commented Sep 3, 2019

From pypa/pip#3535:

From pypa/pip#3383 it'd be nice to have better detection of debug builds on Windows.

@zooba said on #3383 (comment)

Py_DEBUG is never going to be in pyconfig.h on Windows as the header is static (no autoconf) and debug/no-debug is determined using the preprocessor at build.
sys.gettotalrefcount is protected by Py_REF_DEBUG, which is not guaranteed to always be set when Py_DEBUG is set. That said, distutils.command.build tests for it, so it's probably safe enough (or at least, there'll be twice as many bugs when it breaks...).
The most reliable check is probably going to be:

any(x[0] == '_d.pyd' for x in imp.get_suffixes())

The only issue with this is that the imp module is deprecated - Python 3.3 and later should really use:

'_d.pyd' in importlib.machinery.EXTENSION_SUFFIXES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.