From a5195b5bea2cd8c20d89a498bd81c147230d6bfe Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 20 Oct 2026 12:21:20 -0500 Subject: [PATCH] gh-159914: Ignore gdb stderr in test_gdb.test_pretty_print test_strings() gets gdb.host_charset() but fails if gdb writes anything to stderr. For example, it fails if gdb logs the warning: "/usr/bin/gdb: warning: Couldn't determine a path for the index cache directory." Even if stdout contains the expected encoding ("UTF-8"). Change test_gdb to only fail if stdout is empty, ignore stderr otherwise to ignore gdb warnings. --- Lib/test/test_gdb/test_pretty_print.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_gdb/test_pretty_print.py b/Lib/test/test_gdb/test_pretty_print.py index ea047a12b802e8..04e06a64aaa5bb 100644 --- a/Lib/test/test_gdb/test_pretty_print.py +++ b/Lib/test/test_gdb/test_pretty_print.py @@ -125,7 +125,7 @@ def test_strings(self): 'python import gdb; print(gdb.host_charset())') encoding = stdout.strip() - if stderr or not encoding: + if not encoding: raise RuntimeError( f'unable to determine the host charset of gdb\n' f'stdout={stdout!r}\n'