Skip to content

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

@henryiii

Description

@henryiii

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):

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions