- 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`.
Interface output queue is full
.. versionadded:: 3.11
+
+.. data:: ENOTCAPABLE
+
+ Capabilities insufficient. This error is mapped to the exception
+ :exc:`PermissionError`.
+
+ .. availability:: WASI
+
+ .. versionadded:: 3.11.1
Raised when trying to run an operation without the adequate access
rights - for example filesystem permissions.
- Corresponds to :c:data:`errno` :py:data:`~errno.EACCES` and :py:data:`~errno.EPERM`.
+ Corresponds to :c:data:`errno` :py:data:`~errno.EACCES`,
+ :py:data:`~errno.EPERM`, and :py:data:`~errno.ENOTCAPABLE`.
+
+ .. versionchanged:: 3.11.1
+ WASI's :py:data:`~errno.ENOTCAPABLE` is now mapped to
+ :exc:`PermissionError`.
.. exception:: ProcessLookupError
--- /dev/null
+On WASI :data:`~errno.ENOTCAPABLE` is now mapped to :exc:`PermissionError`.
+The :mod:`errno` modules exposes the new error number. ``getpath.py`` now
+ignores :exc:`PermissionError` when it cannot open landmark files
+``pybuilddir.txt`` and ``pyenv.cfg``.
#ifdef EQFULL
add_errcode("EQFULL", EQFULL, "Interface output queue is full");
#endif
+#ifdef ENOTCAPABLE
+ // WASI extension
+ add_errcode("ENOTCAPABLE", ENOTCAPABLE, "Capabilities insufficient");
+#endif
Py_DECREF(error_dict);
return 0;
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 = []
# 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':
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);