gh-155009: Fix argparse test on non-UTF-8 locales like Raspbian (#155227)
hugovk <[email protected]> Thu, 06 Aug 2026 06:49:13 -0400 (EDT)
| Newsgroups | gmane.comp.python.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://github.com/python/cpython/commit/297eb1b7488a46c8b6c4d87caaf658463ca72059 commit: 297eb1b7488a46c8b6c4d87caaf658463ca72059 branch: main author: Hugo van Kemenade <[email protected]> committer: hugovk <[email protected]> date: 2026-08-06T13:48:58+03:00 summary: gh-155009: Fix argparse test on non-UTF-8 locales like Raspbian (#155227) files: M Lib/test/test_argparse.py diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 950671e4395cd4..1193cdca3e4e19 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -7364,6 +7364,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]