You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 581b894
Browse filesBrowse the repository at this point in the historyBrowse files
Ignore PermissionError when checking cwd during import
On macOS `getcwd(3)` can return EACCES if a path component isn't readable,
resulting in PermissionError. `PathFinder.find_spec()` now catches these and
ignores them - the same treatment as a missing/deleted cwd.
Introduces 2 new `test.support.os_helper` context managers
- `save_mode(path, ...)` - restores the mode of a path on exit
- `save_cwd(...)` - restores the current directory on exit
Unlike `change_cwd(path)` (which always performs a `chdir(path)`),
`save_cwd()` allows the code inside the `with` block to control this. The new
context manager just restores the original working directory afterward.
This is allows finer control of exception handling and robust environment
restoration across platforms in `FinderTests.test_permission_error_cwd()`.
0 commit comments