mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
Issue #18416: Fix various os calls in importlib.machinery.FileFinder
now that self.path is no longer forced to '.'.
This commit is contained in:
parent
af002e6482
commit
bb9e481efa
2 changed files with 781 additions and 779 deletions
|
@ -1390,7 +1390,7 @@ class FileFinder:
|
||||||
is_namespace = False
|
is_namespace = False
|
||||||
tail_module = fullname.rpartition('.')[2]
|
tail_module = fullname.rpartition('.')[2]
|
||||||
try:
|
try:
|
||||||
mtime = _os.stat(self.path).st_mtime
|
mtime = _os.stat(self.path or _os.getcwd()).st_mtime
|
||||||
except OSError:
|
except OSError:
|
||||||
mtime = -1
|
mtime = -1
|
||||||
if mtime != self._path_mtime:
|
if mtime != self._path_mtime:
|
||||||
|
@ -1432,7 +1432,7 @@ class FileFinder:
|
||||||
"""Fill the cache of potential modules and packages for this directory."""
|
"""Fill the cache of potential modules and packages for this directory."""
|
||||||
path = self.path
|
path = self.path
|
||||||
try:
|
try:
|
||||||
contents = _os.listdir(path)
|
contents = _os.listdir(path or _os.getcwd())
|
||||||
except (FileNotFoundError, PermissionError, NotADirectoryError):
|
except (FileNotFoundError, PermissionError, NotADirectoryError):
|
||||||
# Directory has either been removed, turned into a file, or made
|
# Directory has either been removed, turned into a file, or made
|
||||||
# unreadable.
|
# unreadable.
|
||||||
|
|
1556
Python/importlib.h
1556
Python/importlib.h
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue