gh-96005: Handle WASI ENOTCAPABLE in getpath (GH-96006)

- 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:
Christian Heimes 2022-08-16 20:20:15 +02:00 committed by GitHub
parent f215d7cac9
commit 48174fa0b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 31 additions and 4 deletions

View file

@ -3635,6 +3635,11 @@ _PyExc_InitState(PyInterpreterState *interp)
ADD_ERRNO(InterruptedError, EINTR);
ADD_ERRNO(PermissionError, EACCES);
ADD_ERRNO(PermissionError, EPERM);
#ifdef ENOTCAPABLE
// Extension for WASI capability-based security. Process lacks
// capability to access a resource.
ADD_ERRNO(PermissionError, ENOTCAPABLE);
#endif
ADD_ERRNO(ProcessLookupError, ESRCH);
ADD_ERRNO(TimeoutError, ETIMEDOUT);