https://github.com/python/cpython/commit/59976fa59ddb8cbaf926760161e11301c4f0b8f1 commit: 59976fa59ddb8cbaf926760161e11301c4f0b8f1 branch: 3.15 author: Miss Islington (bot) <[email protected]> committer: hugovk <[email protected]> date: 2026-08-07T12:25:33Z summary:
[3.15] gh-155009: Fix argparse test on non-UTF-8 locales like Raspbian (GH-155227) (#155270) Co-authored-by: Hugo van Kemenade <[email protected]> files: M Lib/test/test_argparse.py diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index ba0350c9f5a91c..c8954b20740019 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -7345,6 +7345,9 @@ def test_module_as_main_without_altering_argv(self): basename = 'module' + os_helper.FS_NONASCII modulename = f'{self.dirname}.{basename}' self.make_script(self.dirname, basename) + # The filesystem encoding may be non-UTF-8, + # but the runner runs in UTF-8 mode + modulename = os.fsencode(modulename).decode("utf-8", "surrogateescape") runner_source = textwrap.dedent(f'''\ import runpy runpy._run_module_as_main({modulename!r}, alter_argv=False) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
