From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Thu, 6 Aug 2026 10:48:58 +0000 (+0300) Subject: gh-155009: Fix argparse test on non-UTF-8 locales like Raspbian (#155227) X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=297eb1b7488a46c8b6c4d87caaf658463ca72059;p=thirdparty%2FPython%2Fcpython.git gh-155009: Fix argparse test on non-UTF-8 locales like Raspbian (#155227) --- diff --git a/Lib/test/test_argparse.py b/Lib/test/test_argparse.py index 950671e4395c..1193cdca3e4e 100644 --- a/Lib/test/test_argparse.py +++ b/Lib/test/test_argparse.py @@ -7364,6 +7364,9 @@ class TestProgName(TestCase): 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)