How to implement IntoPyObject for a class which extends a base class? #4955
-
|
The docs for IntoPyObject quite tantalisingly say
But I didn't find anywhere a description of how to deal with a class which does extend a base class. Here's my class and here's my legacy conversion which works nicely in PyO3 0.22, which I need to adapt to use And I could really do with a pointer towards how to do this now! In case it helps, my source code is here. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Since you already use Previously |
Beta Was this translation helpful? Give feedback.
Since you already use
Py::newyou already have a Python object and there is no need to useIntoPyObject. You should be able to justreplace your
into_pycall withinto_anyto remove the type info.Previously
IntoPyforPywas just throwing away the type information.IntoPyObjectis also implemented forPybut now keeps the type information.IntoPyObjectExtalso provides a few helpers for common type conversions.