Skip to content

Improve test_capi.test_structmembers #114392

Closed
@serhiy-storchaka

Description

@serhiy-storchaka

test_capi.test_structmembers tests writing and reading attributes that represent C struct members (defined via PyMemberDef). But for most types it only tests 1 or 2 valid values, and maybe yet 1 or 2 values that trigger a RuntimeWarning, for some types. It does not test integer overflow errors. It does not test integer-like objects which are not instances of int (and the range of accepted values is different for such objects due to quirks of implementation). Some bugs (like #114388, but I'll open more issues for other bugs or quirks) are slipped unnoticed.

I'm going to add support for more C types, so I need more comprehensive tests. The proposed PR unifies tests for integer members. It contains some special cases which will be removed when the implementation for integer members be fixed and unified.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.11only security fixes3.12only security fixes3.13bugs and security fixestestsTests in the Lib/test dirtopic-C-API

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions