Any way to access the PyTypeObject
created by a class_
?
#3323
-
Is there any way to get a pointer to the underlying This would be useful, for example, if a user wanted to register a class as a new numpy dtype, which requires creating and registering a I looked through the implementation of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Off the top of my head, you may be able to use PyBind11 type object through the |
Beta Was this translation helpful? Give feedback.
-
Thanks! That seems to be exactly what I was looking for |
Beta Was this translation helpful? Give feedback.
Off the top of my head, you may be able to use PyBind11 type object through the
py::type::of<MyClass>()
feature: https://pybind11.readthedocs.io/en/stable/advanced/classes.html#accessing-the-type-object and then access the underlying PyTypeObject by calling.ptr()
or.release()
.