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
What I want to do here is pass, as default argument, an empty buffer (something that would have a size of 0 when requesting its buffer_info). However the code above fails when the module is imported, with the following exception:
ImportError: arg(): could not convert default argument into a Python object (type not registered yet?). Compile in debug mode for more information.
Note that I'm able to use py::buffer as argument without any problem. It's only when I try to use it as a default value for a parameter that the exception is raised.
Is that a bug? If not, how can I provider a default "empty buffer" argument to such a function?
Note: I would like to avoid using py::object as argument that I would cast into a py::buffer into the function, and handle None as an empty buffer, because I have other overloads of this function (for instance one that takes an std::string instead of a py::buffer).
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
-
I have a code that looks like the following:
What I want to do here is pass, as default argument, an empty buffer (something that would have a
size
of 0 when requesting itsbuffer_info
). However the code above fails when the module is imported, with the following exception:Note that I'm able to use
py::buffer
as argument without any problem. It's only when I try to use it as a default value for a parameter that the exception is raised.Is that a bug? If not, how can I provider a default "empty buffer" argument to such a function?
Note: I would like to avoid using
py::object
as argument that I would cast into apy::buffer
into the function, and handleNone
as an empty buffer, because I have other overloads of this function (for instance one that takes anstd::string
instead of apy::buffer
).Beta Was this translation helpful? Give feedback.
All reactions