You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
sysconfig.get_config_var("Py_DEBUG") is not picked up on Windows builds #133878
changed the title [-]how to properly enable and use Py_DEBUG on Windows?[/-][+]`sysconfig.get_config_var("Py_DEBUG")` is not picked up on Windows builds[/+]on May 11, 2025
Changing the build configuration and how it's being built is out-of-scope of this issue and this is not something we want to do now. In this case, we need to figure out why sysconfig doesn't pickup Py_DEBUG or whether it's not set.
Yeah sysconfig on Windows doesn't pick up anything automatically, as there's no Makefile for it to parse. XuehaiPan added some variables for 3.14 - prior to that, you needed to look for debug-only attributes (e.g. sys.gettotalrefcount is a popular choice) or Path(sys.executable).match("*_d.exe").
Activity
StanFromIreland commentedon May 11, 2025
picnixz commentedon May 11, 2025
@zooba should a build with
-dbe expected to definePy_DEBUGas well? We have thisbut it appears that
sysconfigcan't pick this up.[-]how to properly enable and use Py_DEBUG on Windows?[/-][+]`sysconfig.get_config_var("Py_DEBUG")` is not picked up on Windows builds[/+]picnixz commentedon May 11, 2025
@cctv130 Does it work better if you're using Python 3.13 or Python 3.14?
StanFromIreland commentedon May 11, 2025
It should, as per the docs:
cpython/PCbuild/readme.txt
Lines 35 to 42 in 9b9cdb6
cctv130 commentedon May 11, 2025
@StanFromIreland
On the Windows platform, the compilation method is different from Linux; the ./configure command is not supported on Windows.
cctv130 commentedon May 11, 2025
If that's the case, then the _DEBUG flag must be added to the MSVC compiler.
picnixz commentedon May 11, 2025
_DEBUGis already MSVC-specific; I think it's more a sysconfig issuecctv130 commentedon May 11, 2025
@picnixz
If that's the case, we can use CMake configuration instead of configure to support more platforms.
picnixz commentedon May 11, 2025
Changing the build configuration and how it's being built is out-of-scope of this issue and this is not something we want to do now. In this case, we need to figure out why sysconfig doesn't pickup
Py_DEBUGor whether it's not set.XuehaiPan commentedon May 11, 2025
The
Py_DEBUGkey insysconfig.get_config_vars()on Windows was added in #131799, which first appeared in Python 3.14.0b1.As the screenshot shows, you are using Python 3.12.10.
zooba commentedon May 11, 2025
Yeah
sysconfigon Windows doesn't pick up anything automatically, as there's no Makefile for it to parse. XuehaiPan added some variables for 3.14 - prior to that, you needed to look for debug-only attributes (e.g.sys.gettotalrefcountis a popular choice) orPath(sys.executable).match("*_d.exe").cctv130 commentedon May 12, 2025
thanks