Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Commit581b894
committed
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 andignores 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 exitUnlike `change_cwd(path)` (which always performs a `chdir(path)`),`save_cwd()` allows the code inside the `with` block to control this. The newcontext manager just restores the original working directory afterward.This is allows finer control of exception handling and robust environmentrestoration across platforms in `FinderTests.test_permission_error_cwd()`.1 parent2762c6c commit581b894
File tree
5 files changed
+83
-6
lines changed- Doc/reference
- Lib
- importlib
- test
- support
- test_importlib/import_
- Misc/NEWS.d/next/Core and Builtins
5 files changed
+83
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
871 | 871 | | |
872 | 872 | | |
873 | 873 | | |
874 | | - | |
875 | | - | |
876 | | - | |
877 | | - | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
878 | 878 | | |
879 | 879 | | |
880 | 880 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1506 | 1506 | | |
1507 | 1507 | | |
1508 | 1508 | | |
1509 | | - | |
| 1509 | + | |
1510 | 1510 | | |
1511 | 1511 | | |
1512 | 1512 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
297 | 324 | | |
298 | 325 | | |
299 | 326 | | |
| |||
508 | 535 | | |
509 | 536 | | |
510 | 537 | | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
511 | 564 | | |
512 | 565 | | |
513 | | - | |
| 566 | + | |
| 567 | + | |
514 | 568 | | |
515 | 569 | | |
516 | 570 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | 3 | | |
3 | 4 | | |
| |||
153 | 154 | | |
154 | 155 | | |
155 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
156 | 176 | | |
157 | 177 | | |
158 | 178 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
0 commit comments
Comments
(0)