Skip to content

[BUG]: Incorrect type hints for older versions #5660

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
3 tasks done
gentlegiantJGC opened this issue May 14, 2025 · 1 comment · Fixed by #5662
Closed
3 tasks done

[BUG]: Incorrect type hints for older versions #5660

gentlegiantJGC opened this issue May 14, 2025 · 1 comment · Fixed by #5662
Labels
triage New bug, unverified

Comments

@gentlegiantJGC
Copy link
Contributor

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

05a6a03

Problem description

A number of the type hints have been updated for never versions of Python but are now incorrect for older versions of Python.
An example is collections.abc.Buffer which was added in Python 3.12 however there are many more examples.

If an extension is compiled against an older version of Python the stub files generated will be incorrect for that version and a static type checker will correctly throw errors.

I would expect the type hints to be correct for the version of Python the extension was compiled against regardless of which version it is.

Reproducible example code


Is this a regression? Put the last known working version here if it is.

Not a regression

@gentlegiantJGC gentlegiantJGC added the triage New bug, unverified label May 14, 2025
@gentlegiantJGC
Copy link
Contributor Author

This was discussed in #5566 but I wanted to create a new issue so it doesn't get lost there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage New bug, unverified
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant