FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Issue #18416: Fix various os calls in importlib.machinery.FileFinder · python/cpython@bb9e481 · GitHub

Repository navigation

Commit bb9e481

Browse files
committed
Issue #18416: Fix various os calls in importlib.machinery.FileFinder
now that self.path is no longer forced to '.'.
1 parent af002e6 commit bb9e481

2 files changed

Lines changed: 780 additions & 778 deletions

File tree

‎Lib/importlib/_bootstrap.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1390,7 +1390,7 @@ def find_loader(self, fullname):
13901390
is_namespace = False
13911391
tail_module = fullname.rpartition('.')[2]
13921392
try:
1393-
mtime = _os.stat(self.path).st_mtime
1393+
mtime = _os.stat(self.path or _os.getcwd()).st_mtime
13941394
except OSError:
13951395
mtime = -1
13961396
if mtime != self._path_mtime:
@@ -1432,7 +1432,7 @@ def _fill_cache(self):
14321432
"""Fill the cache of potential modules and packages for this directory."""
14331433
path = self.path
14341434
try:
1435-
contents = _os.listdir(path)
1435+
contents = _os.listdir(path or _os.getcwd())
14361436
except (FileNotFoundError, PermissionError, NotADirectoryError):
14371437
# Directory has either been removed, turned into a file, or made
14381438
# unreadable.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL