[issue38735] PYTHONPYCACHEPREFIX fails when importing a module from the root ("/")

STINNER Victor report at bugs.python.org
Thu Nov 7 07:11:41 EST 2019


STINNER Victor <vstinner at python.org> added the comment:

The bug occurs on this line:

    if sys.pycache_prefix is not None:
        if not _path_isabs(head):
            head = _path_join(_os.getcwd(), head)
        if head[1] == ':' and head[0] not in path_separators: # <==== HERE
            head = head[2:]
        ...

I guess that head="/" in your case: so head[1] raises an IndexError.

----------
nosy: +vstinner

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38735>
_______________________________________


More information about the Python-bugs-list mailing list