bpo-44070: No longer eagerly makes import filenames absolute, except for extension modules (GH-26025)

This commit is contained in:
Steve Dower 2021-05-10 23:45:50 +01:00 committed by GitHub
parent fbd9b9939c
commit 23822e2c65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 1848 additions and 1845 deletions

View file

@ -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):