pybind / pybind/pybind11-stubgen
Incorrect type annotation for Union
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 361
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Description
I got something like
Number: typing._UnionGenericAlias # value = typing.Union[int, float, bool]
where I expect the correct annotation to be either
Number = typing.Union[int, float, bool]
or PEP 613-style:
Number: TypeAlias = int | float | bool
I'm using version 2.5.5.
Please let me know if I was doing something wrong, or point me to the relevant source code so that I can make a PR. Thanks!
Contributor guide
No contributing guide indexed for this repository
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
Reproduce the reported output with pybind11-stubgen 2.5.5 using a value annotated as typing.Union[int, float, bool]. Then trace the annotation-generation entry point that emits _UnionGenericAlias and compare the result with the requested Union or TypeAlias forms; done means the generated stub uses a valid, intended annotation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100