Skip to content

Commit

Permalink
pythongh-96005: FreeBSD has ENOTCAPABLE, too (pythonGH-96034)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiran committed Aug 17, 2022
1 parent d4ff6ff commit 5f4adff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Doc/library/errno.rst
Expand Up @@ -663,6 +663,6 @@ defined by the module. The specific list of defined symbols is available as
Capabilities insufficient. This error is mapped to the exception
:exc:`PermissionError`.

.. availability:: WASI
.. availability:: WASI, FreeBSD

.. versionadded:: 3.11.1
6 changes: 4 additions & 2 deletions Lib/test/test_exception_hierarchy.py
Expand Up @@ -63,7 +63,7 @@ def test_select_error(self):
+-- InterruptedError EINTR
+-- IsADirectoryError EISDIR
+-- NotADirectoryError ENOTDIR
+-- PermissionError EACCES, EPERM
+-- PermissionError EACCES, EPERM, ENOTCAPABLE
+-- ProcessLookupError ESRCH
+-- TimeoutError ETIMEDOUT
"""
Expand All @@ -75,6 +75,8 @@ def _make_map(s):
continue
excname, _, errnames = line.partition(' ')
for errname in filter(None, errnames.strip().split(', ')):
if errname == "ENOTCAPABLE" and not hasattr(errno, errname):
continue
_map[getattr(errno, errname)] = getattr(builtins, excname)
return _map
_map = _make_map(_pep_map)
Expand All @@ -91,7 +93,7 @@ def test_errno_mapping(self):
othercodes = set(errno.errorcode) - set(self._map)
for errcode in othercodes:
e = OSError(errcode, "Some message")
self.assertIs(type(e), OSError)
self.assertIs(type(e), OSError, repr(e))

def test_try_except(self):
filename = "some_hopefully_non_existing_file"
Expand Down

0 comments on commit 5f4adff

Please sign in to comment.