mirror of
https://github.com/python/cpython.git
synced 2025-08-22 01:35:16 +00:00
bpo-45207: Make test_gdb.test_pycfunction() quiet (GH-28355) (GH-28366)
test_gdb.test_pycfunction() now ignores gdb stderr, it no longer logs
messages like:
Function "meth_varargs" not defined.
(cherry picked from commit 84a6061e29
)
Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
97802a8edb
commit
1c70efcbb5
1 changed files with 11 additions and 3 deletions
|
@ -145,7 +145,8 @@ class DebuggerTests(unittest.TestCase):
|
||||||
def get_stack_trace(self, source=None, script=None,
|
def get_stack_trace(self, source=None, script=None,
|
||||||
breakpoint=BREAKPOINT_FN,
|
breakpoint=BREAKPOINT_FN,
|
||||||
cmds_after_breakpoint=None,
|
cmds_after_breakpoint=None,
|
||||||
import_site=False):
|
import_site=False,
|
||||||
|
ignore_stderr=False):
|
||||||
'''
|
'''
|
||||||
Run 'python -c SOURCE' under gdb with a breakpoint.
|
Run 'python -c SOURCE' under gdb with a breakpoint.
|
||||||
|
|
||||||
|
@ -224,6 +225,7 @@ class DebuggerTests(unittest.TestCase):
|
||||||
# Use "args" to invoke gdb, capturing stdout, stderr:
|
# Use "args" to invoke gdb, capturing stdout, stderr:
|
||||||
out, err = run_gdb(*args, PYTHONHASHSEED=PYTHONHASHSEED)
|
out, err = run_gdb(*args, PYTHONHASHSEED=PYTHONHASHSEED)
|
||||||
|
|
||||||
|
if not ignore_stderr:
|
||||||
for line in err.splitlines():
|
for line in err.splitlines():
|
||||||
print(line, file=sys.stderr)
|
print(line, file=sys.stderr)
|
||||||
|
|
||||||
|
@ -908,6 +910,9 @@ id(42)
|
||||||
cmd,
|
cmd,
|
||||||
breakpoint=func_name,
|
breakpoint=func_name,
|
||||||
cmds_after_breakpoint=['bt', 'py-bt'],
|
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)
|
self.assertIn(f'<built-in method {func_name}', gdb_output)
|
||||||
|
|
||||||
|
@ -916,6 +921,9 @@ id(42)
|
||||||
cmd,
|
cmd,
|
||||||
breakpoint=func_name,
|
breakpoint=func_name,
|
||||||
cmds_after_breakpoint=['py-bt-full'],
|
cmds_after_breakpoint=['py-bt-full'],
|
||||||
|
# bpo-45207: Ignore 'Function "meth_varargs" not
|
||||||
|
# defined.' message in stderr.
|
||||||
|
ignore_stderr=True,
|
||||||
)
|
)
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
f'#{expected_frame} <built-in method {func_name}',
|
f'#{expected_frame} <built-in method {func_name}',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue