[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:
Christian Heimes 2022-09-13 13:00:45 +02:00 committed by GitHub
parent c4cf745c72
commit bc337a7766
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 35 additions and 6 deletions

View file

@ -3644,6 +3644,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);