[Python-checkins] bpo-45207: Make test_gdb.test_pycfunction() quiet (GH-28355) (GH-28365)

ambv webhook-mailer at python.org
Wed Sep 15 15:10:38 EDT 2021


https://github.com/python/cpython/commit/bbaf5c27e659cf372c34a6fe7ca31a2f5cb20a50
commit: bbaf5c27e659cf372c34a6fe7ca31a2f5cb20a50
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: ambv <lukasz at langa.pl>
date: 2021-09-15T21:10:33+02:00
summary:

bpo-45207: Make test_gdb.test_pycfunction() quiet (GH-28355) (GH-28365)

test_gdb.test_pycfunction() now ignores gdb stderr, it no longer logs
messages like:

    Function "meth_varargs" not defined.
(cherry picked from commit 84a6061e29e9dc13909bdf6f541f48c2a4f1d410)

Co-authored-by: Victor Stinner <vstinner at python.org>

files:
M Lib/test/test_gdb.py

diff --git a/Lib/test/test_gdb.py b/Lib/test/test_gdb.py
index 22c75bae98721..5f554897f86a0 100644
--- a/Lib/test/test_gdb.py
+++ b/Lib/test/test_gdb.py
@@ -145,7 +145,8 @@ class DebuggerTests(unittest.TestCase):
     def get_stack_trace(self, source=None, script=None,
                         breakpoint=BREAKPOINT_FN,
                         cmds_after_breakpoint=None,
-                        import_site=False):
+                        import_site=False,
+                        ignore_stderr=False):
         '''
         Run 'python -c SOURCE' under gdb with a breakpoint.
 
@@ -224,8 +225,9 @@ def get_stack_trace(self, source=None, script=None,
         # Use "args" to invoke gdb, capturing stdout, stderr:
         out, err = run_gdb(*args, PYTHONHASHSEED=PYTHONHASHSEED)
 
-        for line in err.splitlines():
-            print(line, file=sys.stderr)
+        if not ignore_stderr:
+            for line in err.splitlines():
+                print(line, file=sys.stderr)
 
         # bpo-34007: Sometimes some versions of the shared libraries that
         # are part of the traceback are compiled in optimised mode and the
@@ -908,6 +910,9 @@ def bar():
                         cmd,
                         breakpoint=func_name,
                         cmds_after_breakpoint=['bt', 'py-bt'],
+                        # bpo-45207: Ignore 'Function "meth_varargs" not
+                        # defined.' message in stderr.
+                        ignore_stderr=True,
                     )
                     self.assertIn(f'<built-in method {func_name}', gdb_output)
 
@@ -916,6 +921,9 @@ def bar():
                         cmd,
                         breakpoint=func_name,
                         cmds_after_breakpoint=['py-bt-full'],
+                        # bpo-45207: Ignore 'Function "meth_varargs" not
+                        # defined.' message in stderr.
+                        ignore_stderr=True,
                     )
                     self.assertIn(
                         f'#{expected_frame} <built-in method {func_name}',



More information about the Python-checkins mailing list