Close #11619: The parser and the import machinery do not encode Unicode

filenames anymore on Windows.
This commit is contained in:
Victor Stinner 2013-08-26 22:28:21 +02:00
parent 33824f6fd7
commit 14e461d5b9
22 changed files with 514 additions and 175 deletions

View file

@ -22,7 +22,7 @@ import test.support
from test.support import (
EnvironmentVarGuard, TESTFN, check_warnings, forget, is_jython,
make_legacy_pyc, rmtree, run_unittest, swap_attr, swap_item, temp_umask,
unlink, unload, create_empty_file, cpython_only)
unlink, unload, create_empty_file, cpython_only, TESTFN_UNENCODABLE)
from test import script_helper
@ -1055,6 +1055,14 @@ class ImportTracebackTests(unittest.TestCase):
finally:
importlib.SourceLoader.load_module = old_load_module
@unittest.skipUnless(TESTFN_UNENCODABLE, 'need TESTFN_UNENCODABLE')
def test_unencodable_filename(self):
# Issue #11619: The Python parser and the import machinery must not
# encode filenames, especially on Windows
pyname = script_helper.make_script('', TESTFN_UNENCODABLE, 'pass')
name = pyname[:-3]
script_helper.assert_python_ok("-c", "mod = __import__(%a)" % name)
if __name__ == '__main__':
# Test needs to be a package, so we can do relative imports.