pdoc3 / pdoc3/pdoc

return annotations for C-buildins (pybind11) are ignored

Open Beginner friendly
#474 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.