https://github.com/python/cpython/commit/5511533f59b51cc2fd5e6dbf09a59def5c1e5cb5
commit: 5511533f59b51cc2fd5e6dbf09a59def5c1e5cb5
branch: 3.13
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: vstinner <vstin...@python.org>
date: 2025-05-28T15:44:03Z
summary:

[3.13] gh-133711: Fix test_regrtest for PYTHONUTF8=1 (GH-134839) (#134843)

gh-133711: Fix test_regrtest for PYTHONUTF8=1 (GH-134839)

Use "backslashreplace" error handler to decode stdout and stderr.
Example:

    vstinner@WIN C:\victor\python\main\build\test_python_worker_8360\x91>
    "C:\victor\python\main\PCbuild\amd64\python_d.exe"  -m test
    --fast-ci --slow-ci --testdir
    C:\Users\vstinner\AppData\Local\Temp\tmp0t59e8da
    test_regrtest_noop1 test_regrtest_noop2 test_regrtest_noop3
    test_regrtest_noop4

Notice the "\x91" byte at the end of the first line: it's the
non-ASCII U+00E6 character encoded to the OEM cp437 code page.
(cherry picked from commit 91618278e7cd1ffc222efa03bb5334bd5a13dc5b)

Co-authored-by: Victor Stinner <vstin...@python.org>

files:
M Lib/test/test_regrtest.py

diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index fa7d2c8733f5d1..747b21e4f83359 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -871,7 +871,10 @@ def test_script_autotest(self):
         self.run_tests(args)
 
     def run_batch(self, *args):
-        proc = self.run_command(args)
+        proc = self.run_command(args,
+                                # gh-133711: cmd.exe uses the OEM code page
+                                # to display the non-ASCII current directory
+                                errors="backslashreplace")
         self.check_output(proc.stdout)
 
     @unittest.skipUnless(sysconfig.is_python_build(),

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to