cpython/Lib/importlib
Alex Willmer a8dc6d6d44
gh-115911: Ignore PermissionError during import from cwd (#116131)
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 `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>
2025-01-26 19:00:28 +00:00
..
metadata gh-120910: Fix issue resolving relative paths outside site-packages. (#120911) 2024-06-23 13:06:07 -04:00
resources gh-123987: Fix NotADirectoryError in NamespaceReader when sentinel present (#124018) 2025-01-26 16:23:54 +00:00
__init__.py gh-125519: Improve traceback if importlib.reload() is called with a non-module object (#125520) 2024-10-21 07:53:21 +01:00
_abc.py gh-102515: Remove unused imports in the Lib/ directory (#102516) 2023-03-08 11:45:38 +00:00
_bootstrap.py gh-122555: Remove removed functions from Doc/data/refcounts.dat (#122556) 2024-08-01 12:26:09 +02:00
_bootstrap_external.py gh-115911: Ignore PermissionError during import from cwd (#116131) 2025-01-26 19:00:28 +00:00
abc.py gh-121604: fix ResourceLoader deprecation warning message (GH-128859) 2025-01-15 21:13:59 +00:00
machinery.py gh-121604: Make sure all deprecated items in importlib raise DeprecationWarning (#128007) 2025-01-14 16:48:46 -08:00
readers.py bpo-46118: Move importlib.resources to its own package. (#30176) 2021-12-30 21:00:48 -05:00
simple.py bpo-46118: Move importlib.resources to its own package. (#30176) 2021-12-30 21:00:48 -05:00
util.py gh-122188: Move magic number to its own file (#122243) 2024-07-30 15:31:05 -04:00