Uh oh!
There was an error while loading. Please reload this page.
gh-115911: Ignore PermissionError during import from cwd - #116131
Conversation
8b1cbd4 to
ff4dfdaComparec026bb9 to
10ebce0Comparemoreati
commented
Mar 1, 2024
The new test fails (as intended) without the accompanying fix. Local test run on macOS 14.3.1 |
Uh oh!
There was an error while loading. Please reload this page.
c48c021 to
f06124dCompare
jaraco
left a comment
There was a problem hiding this comment.
Looks good to me, but I'd like to see another review from someone more familiar with importlib internals.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Thanks for making the requested changes! @brettcannon: please review the changes made to this pull request. |
f4d5e67 to
03f2dd6CompareOn 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 `test.support.os_helper.save_mode(path, ...)`, a context manager that restores the mode of a path on exit. This is allows finer control of exception handling and robust environment restoration across platforms in `FinderTests.test_permission_error_cwd()`. Co-authored-by: Jason R. Coombs <jaraco@jaraco.com> Co-authored-by: Brett Cannon <brett@python.org>
moreati
commented
Jan 2, 2025
Failure |
moreati
commented
Jan 2, 2025
@brettcannon I believe I've made the changes you requested. Please could you take another look? |
jaraco
left a comment
There was a problem hiding this comment.
Given that you address Brett's changes, I'm inclined to push this forward. We can revisit (and revert) if necessary.
Concerns were addressed. Let's proceed.
bedevere-bot
commented
Jan 26, 2025
|
moreati
commented
Jan 27, 2025
I think the buildbot failure is a flaky test, atleast on that runner. Of the 5 previous builds 3 failed on this test (3138, 3139, 3140) have failed in the same test, 2 succeeded (3142, 3143). Trying to reproduce the failure locally I saw it with the revision from this PR (a8dc6d6), but not previous revision in main (914c232). |
moreati
commented
Jan 27, 2025
A second local run with rev a8dc6d6 has succeeded |
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
test.support.os_helper.save_mode(path, ...), a context manager that restores the mode of a path on exit.This is allows finer control of exception handling and robust environment restoration across platforms in
FinderTests.test_permission_error_cwd().Fixes#115911
📚 Documentation preview 📚: https://cpython-previews--116131.org.readthedocs.build/