[New-bugs-announce] [issue37499] test_gdb.test_pycfunction should use dedicated test functions

Paul Ganssle report at bugs.python.org
Thu Jul 4 16:29:24 EDT 2019


New submission from Paul Ganssle <p.ganssle at 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 <report at bugs.python.org>
<https://bugs.python.org/issue37499>
_______________________________________


More information about the New-bugs-announce mailing list