Skip to content

Commit b3e73b3

Browse files
committed
Merge for #27083
2 parents 33ed881 + a47a7a5 commit b3e73b3

File tree

4 files changed

+2354
-2346
lines changed

4 files changed

+2354
-2346
lines changed

Lib/importlib/_bootstrap_external.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ def _make_relax_case():
2929
if sys.platform.startswith(_CASE_INSENSITIVE_PLATFORMS):
3030
def _relax_case():
3131
"""True if filenames must be checked case-insensitively."""
32-
return b'PYTHONCASEOK' in _os.environ
32+
return (b'PYTHONCASEOK' in _os.environ
33+
or 'PYTHONCASEOK' in _os.environ)
3334
else:
3435
def _relax_case():
3536
"""True if filenames must be checked case-insensitively."""

Lib/test/test_importlib/source/test_case_sensitivity.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,17 @@ def sensitivity_test(self):
3838
insensitive_finder = self.finder(insensitive_path)
3939
return self.find(sensitive_finder), self.find(insensitive_finder)
4040

41+
def env_changed(self, *, should_exist):
42+
possibilities = b'PYTHONCASEOK', 'PYTHONCASEOK'
43+
if any(x in self.importlib._bootstrap_external._os.environ
44+
for x in possibilities) == should_exist:
45+
self.skipTest('os.environ changes not reflected in '
46+
'_os.environ')
47+
4148
def test_sensitive(self):
4249
with test_support.EnvironmentVarGuard() as env:
4350
env.unset('PYTHONCASEOK')
44-
if b'PYTHONCASEOK' in self.importlib._bootstrap_external._os.environ:
45-
self.skipTest('os.environ changes not reflected in '
46-
'_os.environ')
51+
self.env_changed(should_exist=False)
4752
sensitive, insensitive = self.sensitivity_test()
4853
self.assertIsNotNone(sensitive)
4954
self.assertIn(self.name, sensitive.get_filename(self.name))
@@ -52,9 +57,7 @@ def test_sensitive(self):
5257
def test_insensitive(self):
5358
with test_support.EnvironmentVarGuard() as env:
5459
env.set('PYTHONCASEOK', '1')
55-
if b'PYTHONCASEOK' not in self.importlib._bootstrap_external._os.environ:
56-
self.skipTest('os.environ changes not reflected in '
57-
'_os.environ')
60+
self.env_changed(should_exist=True)
5861
sensitive, insensitive = self.sensitivity_test()
5962
self.assertIsNotNone(sensitive)
6063
self.assertIn(self.name, sensitive.get_filename(self.name))

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ What's New in Python 3.6.0 alpha 4
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #27083: Respect the PYTHONCASEOK environment variable under Windows.
14+
1315
- Issue #27514: Make having too many statically nested blocks a SyntaxError
1416
instead of SystemError.
1517

0 commit comments

Comments
 (0)