Skip to content

Generating bad types for py::bool_ and py::float_ #75

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alkatar21 opened this issue Jan 15, 2022 · 2 comments
Closed

Generating bad types for py::bool_ and py::float_ #75

alkatar21 opened this issue Jan 15, 2022 · 2 comments
Labels
wontfix This will not be worked on

Comments

@alkatar21
Copy link

I use

using PyBaseTypes = std::variant<py::bool_, py::int_, py::float_, py::str, py::bytes, py::object>;

Generated then:

typing.Union[bool_, int, float_, str, bytes, object]

I would expect:

typing.Union[bool, int, float, str, bytes, object]

I'm not quite sure if the fault is here or with pybind11.

bybind11: 2.9.0
pybind11-stubgen: 0.10.5

@sizmailov
Copy link
Owner

Thanks for report. I filed a PR to pybind11: pybind/pybind11#3622.

At the moment pybind11-stubgen does not have fine-grained type processing and operates on whole strings. Therefore the simplest "solution" like plain replacements (e.g. bool_ -> bool) on stubgen side might be harmful.

@sizmailov sizmailov changed the title Generating bad base types? Generating bad types for py::bool_ and py::float_ Jan 15, 2022
@sizmailov sizmailov added the wontfix This will not be worked on label Jan 17, 2022
@sizmailov
Copy link
Owner

The PR is merged in pybind11 master. If you are affected by this issue consider updating to latest pybind11 version.
I'm closing this as "won't fix" due to lack readily available solution on stubgen side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants