New submission from Paul Ganssle <p.gans...@gmail.com>:

Currently, `test_pycfunction` picks a few built-in functions with various 
calling conventions to exercise all the relevant code paths:

        for py_name, py_args, c_name, expected_frame_number in (
            ('gmtime', '', 'time_gmtime', 1),  # METH_VARARGS
            ('len', '[]', 'builtin_len', 2),  # METH_O
            ...

See: 
https://github.com/python/cpython/blob/2f19e82fbe98ce86bcd98a176328af2808b678e8/Lib/test/test_gdb.py#L851

These calling conventions are not a guaranteed part of the interface, and as 
such these tests are fragile (as we saw in GH-14311, when converting the time 
module to use Argument Clinic changed gmtime from METH_VARARGS to 
METH_FASTCALL). Per Victor's suggestion in GH-14330, I think we should expose a 
few test functions in the `testcapi` module as exemplars of their respective 
calling conventions and use those, rather than arbitrary builtins.

----------
components: Tests
messages: 347295
nosy: p-ganssle, vstinner
priority: low
severity: normal
stage: needs patch
status: open
title: test_gdb.test_pycfunction should use dedicated test functions
type: enhancement
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37499>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to