Replies: 1 comment
-
Hi @hawkinsp -- thank you for suggesting this. I had a look and think it's a bit too specific for inclusion in nanobind. The more important thing to me is that the low level functionality exists to enable such extensions. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a pair of utilities that I use widely in my code, defined here:
https://github.com/openxla/xla/blob/main/xla/python/nb_class_ptr.h
nb_class_ptr<T>
: is a subclass ofnb::object
that is analogous tostd::shared_ptr<T>
, but for objects known to nanobind that are allocated on the Python heap and that use Python reference counting.make_nb_class<T>
: is analogous tostd::make_shared<T>
. This allocates and constructs an object of type T in place on the Python heap, and returns annb_class_ptr<T>
.Are these things that you might be interested in accepting as contributions upstream, in some form?
Beta Was this translation helpful? Give feedback.
All reactions