diff options
| author | Marc Mueller <30130371+cdce8p@users.noreply.github.com> | 2022-03-07 20:18:20 +0100 |
|---|---|---|
| committer | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2022-03-07 22:59:48 +0100 |
| commit | 9344ab346e45ed3a4ae2b42f3088c2c69b58cdbf (patch) | |
| tree | 5c58abda1dae605c3df91802d5071b810c13b4da | |
| parent | 419367e48fbcf6f2550982539bf459b701eea579 (diff) | |
| download | astroid-git-9344ab346e45ed3a4ae2b42f3088c2c69b58cdbf.tar.gz | |
Fix STD_LIB_DIRS for PyPy 3.7+
| -rw-r--r-- | astroid/modutils.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/astroid/modutils.py b/astroid/modutils.py index 7cce55b4..f853408b 100644 --- a/astroid/modutils.py +++ b/astroid/modutils.py @@ -84,18 +84,18 @@ if os.name == "nt": except AttributeError: pass -if platform.python_implementation() == "PyPy": +if platform.python_implementation() == "PyPy" and sys.version_info < (3, 8): # PyPy stores the stdlib in two places: sys.prefix/lib_pypy and sys.prefix/lib-python/3 # sysconfig.get_path on PyPy returns the first, but without an underscore so we patch this manually. + # Beginning with 3.8 the stdlib is only stored in: sys.prefix/pypy{py_version_short} STD_LIB_DIRS.add(str(Path(sysconfig.get_path("stdlib")).parent / "lib_pypy")) - STD_LIB_DIRS.add( - sysconfig.get_path("stdlib", vars={"implementation_lower": "python/3"}) - ) + STD_LIB_DIRS.add(str(Path(sysconfig.get_path("stdlib")).parent / "lib-python/3")) + # TODO: This is a fix for a workaround in virtualenv. At some point we should revisit # whether this is still necessary. See https://github.com/PyCQA/astroid/pull/1324. STD_LIB_DIRS.add(str(Path(sysconfig.get_path("platstdlib")).parent / "lib_pypy")) STD_LIB_DIRS.add( - sysconfig.get_path("platstdlib", vars={"implementation_lower": "python/3"}) + str(Path(sysconfig.get_path("platstdlib")).parent / "lib-python/3") ) if os.name == "posix": |
