mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-44070: No longer eagerly makes import filenames absolute, except for extension modules (GH-26025)
This commit is contained in:
parent
fbd9b9939c
commit
23822e2c65
4 changed files with 1848 additions and 1845 deletions
|
@ -718,11 +718,6 @@ def spec_from_file_location(name, location=None, *, loader=None,
|
|||
pass
|
||||
else:
|
||||
location = _os.fspath(location)
|
||||
if not _path_isabs(location):
|
||||
try:
|
||||
location = _path_join(_os.getcwd(), location)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
# If the location is on the filesystem, but doesn't actually exist,
|
||||
# we could return None here, indicating that the location is not
|
||||
|
@ -1159,6 +1154,11 @@ class ExtensionFileLoader(FileLoader, _LoaderBasics):
|
|||
|
||||
def __init__(self, name, path):
|
||||
self.name = name
|
||||
if not _path_isabs(path):
|
||||
try:
|
||||
path = _path_join(_os.getcwd(), path)
|
||||
except OSError:
|
||||
pass
|
||||
self.path = path
|
||||
|
||||
def __eq__(self, other):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue