Skip to content

Commit da0aa51

Browse files
authored
gh-96005: FreeBSD has ENOTCAPABLE, too (GH-96034)
1 parent f51f54f commit da0aa51

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

Doc/library/errno.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,6 @@ defined by the module. The specific list of defined symbols is available as
663663
Capabilities insufficient. This error is mapped to the exception
664664
:exc:`PermissionError`.
665665

666-
.. availability:: WASI
666+
.. availability:: WASI, FreeBSD
667667

668668
.. versionadded:: 3.11.1

Lib/test/test_exception_hierarchy.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def test_select_error(self):
6363
+-- InterruptedError EINTR
6464
+-- IsADirectoryError EISDIR
6565
+-- NotADirectoryError ENOTDIR
66-
+-- PermissionError EACCES, EPERM
66+
+-- PermissionError EACCES, EPERM, ENOTCAPABLE
6767
+-- ProcessLookupError ESRCH
6868
+-- TimeoutError ETIMEDOUT
6969
"""
@@ -75,6 +75,8 @@ def _make_map(s):
7575
continue
7676
excname, _, errnames = line.partition(' ')
7777
for errname in filter(None, errnames.strip().split(', ')):
78+
if errname == "ENOTCAPABLE" and not hasattr(errno, errname):
79+
continue
7880
_map[getattr(errno, errname)] = getattr(builtins, excname)
7981
return _map
8082
_map = _make_map(_pep_map)
@@ -91,7 +93,7 @@ def test_errno_mapping(self):
9193
othercodes = set(errno.errorcode) - set(self._map)
9294
for errcode in othercodes:
9395
e = OSError(errcode, "Some message")
94-
self.assertIs(type(e), OSError)
96+
self.assertIs(type(e), OSError, repr(e))
9597

9698
def test_try_except(self):
9799
filename = "some_hopefully_non_existing_file"

0 commit comments

Comments
 (0)