mirror of
https://github.com/python/cpython.git
synced 2025-09-13 04:08:37 +00:00
[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:
parent
c4cf745c72
commit
bc337a7766
7 changed files with 35 additions and 6 deletions
|
@ -63,7 +63,7 @@ class HierarchyTest(unittest.TestCase):
|
|||
+-- InterruptedError EINTR
|
||||
+-- IsADirectoryError EISDIR
|
||||
+-- NotADirectoryError ENOTDIR
|
||||
+-- PermissionError EACCES, EPERM
|
||||
+-- PermissionError EACCES, EPERM, ENOTCAPABLE
|
||||
+-- ProcessLookupError ESRCH
|
||||
+-- TimeoutError ETIMEDOUT
|
||||
"""
|
||||
|
@ -75,6 +75,8 @@ class HierarchyTest(unittest.TestCase):
|
|||
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)
|
||||
|
@ -91,7 +93,7 @@ class HierarchyTest(unittest.TestCase):
|
|||
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"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue