Skip to content

Add tests for setting and deleting attributes defined in C #156106

Description

@serhiy-storchaka

CPython defines 375 attributes with PyMemberDef and PyGetSetDef (excluding the _test* modules), but the test suite never assigns to 187 of them and never deletes 332 of them.

Deletion in particular is almost untested, although it is a separate code path: the setter is called with NULL, and an implementation which does not expect this crashes or leaves the object in a broken state.

Three bugs found this way are gh-156099, gh-156100 and gh-156101; gh-152817 is another one.

The following PR adds writing and deleting tests for each writable attribute.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions