Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
bpo-20177: use builtin_dir to test METH_VARARGS
  • Loading branch information
jdemeyer committed Jun 24, 2019
commit 7c2b7740eab7340674f34970633c1634670749ce
20 changes: 10 additions & 10 deletions Lib/test/test_gdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -849,19 +849,19 @@ def test_pycfunction(self):
# Various optimizations multiply the code paths by which these are
# called, so test a variety of calling conventions.
for py_name, py_args, c_name, expected_frame_number in (
('gmtime', '', 'time_gmtime', 1), # METH_VARARGS
('len', '[]', 'builtin_len', 2), # METH_O
('locals', '', 'builtin_locals', 2), # METH_NOARGS
('iter', '[]', 'builtin_iter', 2), # METH_FASTCALL
('dir', 'object', 'builtin_dir', 1), # METH_VARARGS
('len', '[]', 'builtin_len', 2), # METH_O
('locals', '', 'builtin_locals', 2), # METH_NOARGS
('iter', '[]', 'builtin_iter', 2), # METH_FASTCALL
('sorted', '[]', 'builtin_sorted', 2), # METH_FASTCALL|METH_KEYWORDS
):
with self.subTest(c_name):
cmd = ('from time import gmtime\n' # (not always needed)
'def foo():\n'
f' {py_name}({py_args})\n'
'def bar():\n'
' foo()\n'
'bar()\n')
cmd = textwrap.dedent(f'''
def foo():
{py_name}({py_args})
def bar():
foo()
bar()''')
# Verify with "py-bt":
gdb_output = self.get_stack_trace(
cmd,
Expand Down