return annotations for C-buildins (pybind11) are ignored
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
For build-in C functions (like with pybind11), inspect.signature().return_annotation (here) can return inspect.Parameter.empty. This stops the fallback chain and the signature in the doc string is ignored.
This is a regression introduced with commit 62c66cb
I'll open a PR later
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 in pdoc/init.py around line 1395, where inspect.signature().return_annotation is handled for built-in C functions such as pybind11 functions. Reproduce the regression from commit 62c66cb and trace why inspect.Parameter.empty stops the fallback chain. Done means the return annotation from the function's docstring is used when the inspected annotation is empty.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 70/100