Skip to content

Commit 570fb35

Browse files
committed
bpo-38735: Don't crash when importing from / with pycache_prefix set
1 parent 994f90c commit 570fb35

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/importlib/_bootstrap_external.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,9 +465,9 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
465465
head = _path_join(_os.getcwd(), head)
466466

467467
# Strip initial drive from a Windows path. We know we have an absolute
468-
# path here, so the second part of the check rules out a POSIX path that
468+
# path here, so the first part of the check rules out a POSIX path that
469469
# happens to contain a colon at the second character.
470-
if head[1] == ':' and head[0] not in path_separators:
470+
if head[0] not in path_separators and head[1] == ':':
471471
head = head[2:]
472472

473473
# Strip initial path separator from `head` to complete the conversion

0 commit comments

Comments
 (0)