https://github.com/python/cpython/commit/88d922ad982c4e00f8cb936cffba154d8d5fb697
commit: 88d922ad982c4e00f8cb936cffba154d8d5fb697
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2026-10-20T13:48:29-05:00
summary:

gh-159914: Ignore gdb stderr in test_gdb.test_pretty_print (#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.

files:
M Lib/test/test_gdb/test_pretty_print.py

diff --git a/Lib/test/test_gdb/test_pretty_print.py 
b/Lib/test/test_gdb/test_pretty_print.py
index ea047a12b802e88..04e06a64aaa5bb7 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'

_______________________________________________
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]

Reply via email to