Skip to content

Commit d8a28ab

Browse files
committed
Formatting and add explanatory comment
1 parent ec0a0b2 commit d8a28ab

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Lib/test/test_gdb.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,12 @@ def test_gc(self):
844844
# Some older versions of gdb will fail with
845845
# "Cannot find new threads: generic error"
846846
# unless we add LD_PRELOAD=PATH-TO-libpthread.so.1 as a workaround
847+
#
848+
# gdb will also generate many erroneous errors such as:
849+
# Function "meth_varargs" not defined.
850+
# This is because we are calling functions from an "external" module
851+
# (_testcapimodule) rather than compiled-in functions. It seems difficult
852+
# to suppress these. See also the comment in DebuggerTests.get_stack_trace
847853
def test_pycfunction(self):
848854
'Verify that "py-bt" displays invocations of PyCFunction instances'
849855
# Various optimizations multiply the code paths by which these are
@@ -866,12 +872,14 @@ def test_pycfunction(self):
866872
# '_testcapi.MethInstance()',
867873
):
868874
with self.subTest(f'{obj}.{func_name}'):
869-
cmd = ('import _testcapi\n' # (not always needed)
870-
'def foo():\n'
871-
f' {obj}.{func_name}({args})\n'
872-
'def bar():\n'
873-
' foo()\n'
874-
'bar()\n')
875+
cmd = textwrap.dedent(f'''
876+
import _testcapi # (not always needed)
877+
def foo():
878+
{obj}.{func_name}({args})
879+
def bar():
880+
foo()
881+
bar()
882+
''')
875883
# Verify with "py-bt":
876884
gdb_output = self.get_stack_trace(
877885
cmd,

0 commit comments

Comments
 (0)