Author eryksun
Recipients brett.cannon, eryksun, paul.moore, steve.dower, tim.golden, zach.ware
Date 2016-05-22.06:45:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
importlib ignores the PYTHONCASEOK environment variable on Windows. _relax_case checks for b'PYTHONCASEOK' in os.environ, which is never true because os.environ is Unicode. On Windows, _make_relax_case should return a function that instead checks for 'PYTHONCASEOK'.

The following test demonstrates that case-insensitive imports otherwise appear to work correctly in 3.5:

    >>> import sys, importlib, glob
    >>> glob.glob('*.py')

    >>> importlib._bootstrap_external._relax_case()
    >>> import test
    >>> test.__file__
    'C:\\Program Files\\Python35\\lib\\test\\'


    >>> src = "_relax_case = lambda: 'PYTHONCASEOK' in _os.environ"
    >>> exec(src, vars(importlib._bootstrap_external))
    >>> importlib._bootstrap_external._relax_case()
    >>> del sys.modules['test']
    >>> import test
    this is a test
    >>> test.__file__

It would be better if __file__ were the actual filename "" instead of "".
Date User Action Args
2016-05-22 06:45:32eryksunsetrecipients: + eryksun, brett.cannon, paul.moore, tim.golden, zach.ware, steve.dower
2016-05-22 06:45:32eryksunsetmessageid: <>
2016-05-22 06:45:31eryksunlinkissue27083 messages
2016-05-22 06:45:31eryksuncreate