diff --git a/Lib/test/test_posix.py b/Lib/test/test_posix.py index 79fc3c264418674034dede55d999076bdc3501d2..165b837134087b00d6237655c92334d7c4b5cd4a 100644 --- a/Lib/test/test_posix.py +++ b/Lib/test/test_posix.py @@ -1522,7 +1522,9 @@ class _PosixSpawnMixin: pid = self.spawn_func(no_such_executable, [no_such_executable], os.environ) - except FileNotFoundError as exc: + # bpo-35794: PermissionError can be raised if there are + # directories in the $PATH that are not accessible. + except (FileNotFoundError, PermissionError) as exc: self.assertEqual(exc.filename, no_such_executable) else: pid2, status = os.waitpid(pid, 0)