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

CPython 3.11 Windows venv module triggers a DeprecationWarning in sysconfig #98741

Closed
henryiii opened this issue Oct 26, 2022 · 0 comments
Closed
Labels
type-bug An unexpected behavior, bug, or error

Comments

@henryiii
Copy link
Contributor

henryiii commented Oct 26, 2022

Bug report

I am seeing the following warning on Windows Python 3.11:

Traceback (most recent call last):
  File "D:\a\build\build\.tox\py311\Lib\site-packages\build\__main__.py", line 373, in main
    built = build_call(
            ^^^^^^^^^^^
  File "D:\a\build\build\.tox\py311\Lib\site-packages\build\__main__.py", line 233, in build_package_via_sdist
    sdist = _build(isolation, builder, outdir, 'sdist', config_settings, skip_dependency_check)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\a\build\build\.tox\py311\Lib\site-packages\build\__main__.py", line 143, in _build
    return _build_in_isolated_env(builder, outdir, distribution, config_settings)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\a\build\build\.tox\py311\Lib\site-packages\build\__main__.py", line 107, in _build_in_isolated_env
    with _IsolatedEnvBuilder() as env:
  File "D:\a\build\build\.tox\py311\Lib\site-packages\build\env.py", line 103, in __enter__
    executable, scripts_dir = _create_isolated_env_venv(self._path)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "D:\a\build\build\.tox\py311\Lib\site-packages\build\env.py", line 265, in _create_isolated_env_venv
    venv.EnvBuilder(with_pip=True, symlinks=symlinks).create(path)
  File "C:\hostedtoolcache\windows\Python\3.11.0\x64\Lib\venv\__init__.py", line 74, in create
    self.setup_python(context)
  File "C:\hostedtoolcache\windows\Python\3.11.0\x64\Lib\venv\__init__.py", line 321, in setup_python
    copier(src, os.path.join(binpath, suffix))
  File "C:\hostedtoolcache\windows\Python\3.11.0\x64\Lib\venv\__init__.py", line 257, in symlink_or_copy
    if sysconfig.is_python_build(True) or not os.path.isfile(srcfn):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\hostedtoolcache\windows\Python\3.11.0\x64\Lib\sysconfig.py", line 222, in is_python_build
    warnings.warn("check_home argument is deprecated and ignored.",
DeprecationWarning: check_home argument is deprecated and ignored.

ERROR check_home argument is deprecated and ignored.

Sure enough, in:

if sysconfig.is_python_build(True) or not os.path.isfile(srcfn):

There's a call to the deprecated form:

cpython/Lib/sysconfig.py

Lines 219 to 223 in 6777e09

def is_python_build(check_home=None):
if check_home is not None:
import warnings
warnings.warn("check_home argument is deprecated and ignored.",
DeprecationWarning, stacklevel=2)

Discovered in pypa/build#527. We weren't checking 3.11-dev on Windows, sadly!

Your environment

  • CPython versions tested on: 3.11.0 on GHA
  • Operating system and architecture: windows-latest on GHA

Edit: there are three of them, plus a usage in test:

$ git grep -n 'is_python_build(True)'
Lib/test/support/__init__.py:1506:            if sysconfig.is_python_build(True):
Lib/venv/__init__.py:263:            if sysconfig.is_python_build(True) or not os.path.isfile(srcfn):
Lib/venv/__init__.py:314:                if sysconfig.is_python_build(True):
Lib/venv/__init__.py:329:            if sysconfig.is_python_build(True):
@henryiii henryiii added the type-bug An unexpected behavior, bug, or error label Oct 26, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Oct 26, 2022
…usage (pythonGH-98743)

(cherry picked from commit a508631)

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
vsajip pushed a commit that referenced this issue Oct 26, 2022
… usage (GH-98743) (GH-98746)

Co-authored-by: Henry Schreiner <HenrySchreinerIII@gmail.com>
@vsajip vsajip closed this as completed Oct 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants