You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mypy complains about the function call because they are not subclasses of int.
If the intention of pybind in these cases is to accept any object that can be coerced into an int it would be nice if they could be type hinted as such.
Required prerequisites
What version (or hash if on master) of pybind11 are you using?
2.12.0
Problem description
It would be nice if functions/methods that accept objects which can be coerced into an int would be typed as such in the docstrings.
Functions that accept a C++ int type currently generate stub files that look like the following.
The function can also be called with any object that implements
__int__
including numpy int types and custom objects.mypy complains about the function call because they are not subclasses of int.
If the intention of pybind in these cases is to accept any object that can be coerced into an int it would be nice if they could be type hinted as such.
The correct result would look like this
or just
Reproducible example code
No response
Is this a regression? Put the last known working version here if it is.
Not a regression
The text was updated successfully, but these errors were encountered: