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

When running bdist_wheel on Windows, warning appears: "Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect" #461

Open
JoevDubach opened this issue Jul 25, 2022 · 1 comment

Comments

@JoevDubach
Copy link

Note that this issue is related to #171 .

When building a wheel with "python -m build --wheel" on Windows, it ends up executing wheel/bdist_wheel.py, and outputs this warning to screen:

C:\temp\build-env-wi_m8kpm\lib\site-packages\wheel\bdist_wheel.py:80: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
  if get_flag('Py_DEBUG',

This is because wheel/src/wheel/bdist_wheel.py has a local implementation of get_abi_tag() that's called by bdist_wheel.get_tag(), which is called by bdist_wheel.run(). This local implementation isn't able to detect the debug attribute properly on Windows, so it issues a warning.

But wheel/src/wheel/vendored/packaging/tags.py has another implementation of this functionality in _cpython_abis() that detects the debug attribute more correctly:

    debug = pymalloc = ucs4 = ""
    with_debug = _get_config_var("Py_DEBUG", warn)
    has_refcount = hasattr(sys, "gettotalrefcount")
    # Windows doesn't set Py_DEBUG, so checking for support of debug-compiled
    # extension modules is the best option.
    # https://github.com/pypa/pip/issues/3383#issuecomment-173267692
    has_ext = "_d.pyd" in EXTENSION_SUFFIXES
    if with_debug or (with_debug is None and (has_refcount or has_ext)):
        debug = "d"

tags._cpython_abis() is called by tags.cpython_tags(), which is called by tags.sys_tags(). See pypa/packaging#194 and pypa/packaging#172 for the relevant recent work that improved this debug attribute detection on Windows.

wheel/src/wheel/bdist_wheel.py already has:

from .vendored.packaging import tags

...and uses tags.interpreter_name(), tags.interpreter_version(), and tags.sys_tags(). So it seems like using the tags module a little more extensively should be safe, as long as it gives the same behavior on all Python versions still supported by wheel (>=3.7 according to wheel/setup.py).

It seems to me that the local implementation of get_abi_tag() could be replaced with an appropriate call to tags.sys_tags(), and get_abi_tag() could be removed. The current code does:

            impl_name = tags.interpreter_name()
            impl_ver = tags.interpreter_version()
            impl = impl_name + impl_ver
            # We don't work on CPython 3.1, 3.0.
            if self.py_limited_api and (impl_name + impl_ver).startswith("cp3"):
                impl = self.py_limited_api
                abi_tag = "abi3"
            else:
                abi_tag = str(get_abi_tag()).lower()
            tag = (impl, abi_tag, plat_name)

...where I could imagine it instead doing:

            impl_name = tags.interpreter_name()
            impl_ver = tags.interpreter_version()
            impl = impl_name + impl_ver
            # We don't work on CPython 3.1, 3.0.
            if self.py_limited_api and (impl_name + impl_ver).startswith("cp3"):
                impl = self.py_limited_api
                abi_tag = "abi3"
                tag = (impl, abi_tag, plat_name)
            else:
                tag = tags.sys_tags()[0]

If this isn't feasible for some reason, another option would be to change the local implementation of get_abi_tag() to imitate the relevant packaging.tags._cpython_abis() code that detects the debug and with_pymalloc attributes, with a particular care not to warn on Windows in an expected situation that is immediately going to be rectified by an appropriate alternate detection mechanism. This is more complicated, so I won't attempt to suggest the exact patch for this option.

@amberkushwaha
Copy link

initiate the mean time ratio in the following team circuit of the file in it by the given folios in it.going to be rectified int he mean time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants