mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
[3.11] gh-96005: Handle WASI ENOTCAPABLE in getpath (GH-96006) (GH-96034) (GH-96038)
- On WASI `ENOTCAPABLE` is now mapped to `PermissionError`. - The `errno` modules exposes the new error number. - `getpath.py` now ignores `PermissionError` when it cannot open landmark files `pybuilddir.txt` and `pyenv.cfg`.
This commit is contained in:
parent
c4cf745c72
commit
bc337a7766
7 changed files with 35 additions and 6 deletions
|
@ -351,11 +351,11 @@ if not home and not py_setpath:
|
|||
try:
|
||||
# Read pyvenv.cfg from one level above executable
|
||||
pyvenvcfg = readlines(joinpath(venv_prefix, VENV_LANDMARK))
|
||||
except FileNotFoundError:
|
||||
except (FileNotFoundError, PermissionError):
|
||||
# Try the same directory as executable
|
||||
pyvenvcfg = readlines(joinpath(venv_prefix2, VENV_LANDMARK))
|
||||
venv_prefix = venv_prefix2
|
||||
except FileNotFoundError:
|
||||
except (FileNotFoundError, PermissionError):
|
||||
venv_prefix = None
|
||||
pyvenvcfg = []
|
||||
|
||||
|
@ -475,7 +475,7 @@ if ((not home_was_set and real_executable_dir and not py_setpath)
|
|||
# File exists but is empty
|
||||
platstdlib_dir = real_executable_dir
|
||||
build_prefix = joinpath(real_executable_dir, VPATH)
|
||||
except FileNotFoundError:
|
||||
except (FileNotFoundError, PermissionError):
|
||||
if isfile(joinpath(real_executable_dir, BUILD_LANDMARK)):
|
||||
build_prefix = joinpath(real_executable_dir, VPATH)
|
||||
if os_name == 'nt':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue