Add tests for setting and deleting attributes defined in C
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
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
- gh-156107
- gh-156184
- gh-156191
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the CPython test coverage for attributes defined with PyMemberDef and PyGetSetDef. Review how writable attributes are currently assigned and deleted, then use the reported gaps and existing tests to cover each writable attribute. Done means assignment and deletion are tested for all writable attributes without crashes or broken objects.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- testing-qa
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100