summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-08-16 18:20:15 (GMT)
committerGitHub <noreply@github.com>2022-08-16 18:20:15 (GMT)
commit48174fa0b949d6b1d0c1f074e7d4e47793759a43 (patch)
tree0a226307f02413be0a6378aaf58a378004b5a3fb /Objects
parentf215d7cac9a6f9b51ba864e4252686dee4e45d64 (diff)
downloadcpython-48174fa0b949d6b1d0c1f074e7d4e47793759a43.zip
cpython-48174fa0b949d6b1d0c1f074e7d4e47793759a43.tar.gz
cpython-48174fa0b949d6b1d0c1f074e7d4e47793759a43.tar.bz2
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`.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/exceptions.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
index c568868..3703fdc 100644
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -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);