diff --git a/Lib/test/test_modulefinder.py b/Lib/test/test_modulefinder.py index ca1058b8d4087c..6aee48044264e3 100644 --- a/Lib/test/test_modulefinder.py +++ b/Lib/test/test_modulefinder.py @@ -399,6 +399,12 @@ def test_replace_paths(self): expected = "co_filename %r changed to %r" % (old_path, new_path) self.assertIn(expected, output) + def test_encoding(self): + os.makedirs(TEST_DIR, exist_ok=True) + with open(os.path.join(TEST_DIR,'a.py'), 'w', encoding='cp1252') as f: + f.write('# -*- coding: cp1252 -*-\nx = "€"\n') + self._do_test(["a", ["a"], [], [], ""]) + def test_extended_opargs(self): extended_opargs_test = [ "a", diff --git a/Misc/NEWS.d/next/Library/2020-01-06-22-39-23.bpo-39206.zKSTwb.rst b/Misc/NEWS.d/next/Library/2020-01-06-22-39-23.bpo-39206.zKSTwb.rst new file mode 100644 index 00000000000000..d3e7801e4e6a20 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2020-01-06-22-39-23.bpo-39206.zKSTwb.rst @@ -0,0 +1 @@ +Fix :mod:`modulefinder` to handle :pep:`263` encoding markers - by Luciana Marques