stubgen (stubgenc): Support for tp_getset style C properties
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Feature
Currently for C extensions, attributes of a C type originating from tp_getset are not recognized as a class property.
It would be nice to still parse the docstring in such cases, to infer types.
Pitch
As far as I understand, this is due to mypy.stubgenc.is_c_property looking for the fget attribute (the tp_getset style attributes dont have such an attribute - at least in my case, python 3.8).
I am not sure how to properly add checks for such a case (is just removing the check hasattr(obj, 'fget') enough?)
Would be glad for any input here (Am I missing something? Is there a good strategy to add support for tp_getset style attributes?). I would offer to implement the feature, if you think this would make sense.
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 at mypy.stubgenc.is_c_property and inspect how stubgen recognizes properties and reads their docstrings. Determine how tp_getset-style C attributes differ from the existing case, then verify that their docstrings can be used to infer property types without affecting other C-extension attributes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100