From 9793ae6da9dd6e1876e17b1d4b1c3a1a1bb45388 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 24 Oct 2026 14:03:13 -0700 Subject: [PATCH] [3.12] gh-159914: Ignore gdb stderr in test_gdb.test_pretty_print (GH-159916) (GH-160201) gh-159914: Ignore gdb stderr in test_gdb.test_pretty_print (GH-159916) 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. (cherry picked from commit 88d922ad982c4e00f8cb936cffba154d8d5fb697) (cherry picked from commit d9b6c229f233eb26952d81381b375f9d6bb99c19) Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Co-authored-by: Victor Stinner --- 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 dfc77d65ab16a40..b110db03b56a1f0 100644 --- a/Lib/test/test_gdb/test_pretty_print.py +++ b/Lib/test/test_gdb/test_pretty_print.py @@ -116,7 +116,7 @@ def test_strings(self): 'python import locale; print(locale.getpreferredencoding())') encoding = stdout - if stderr or not encoding: + if not encoding: raise RuntimeError( f'unable to determine the Python locale preferred encoding ' f'of embedded Python in GDB\n'