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
// main.cpp
#include<pybind11/pybind11.h>PYBIND11_MODULE(example, m)
{
m.def("get", [](constsize_tindex) { returnindex; }, pybind11::arg("index"), "A function that returns a number");
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I will start with an example:
I build it with:
And then I have Python script:
Which when run (
python3 main.py
) gives output:Which is very confusable for the users of such module. You pass
int
and the console says that provided argument is not anint
butint
is supported:The same misleading information can be obtained when called using
help(example.get)
:What can I do to make it more explicit in such cases that
size_t
(or any other unsigned integer) is the supported argument butsigned integer
is not?Beta Was this translation helpful? Give feedback.
All reactions