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
Issue:
In an example setter I get a pybind11:list with two entries, the first has to be kept alive the other arguments need to be garbage collected (large bytestream that I copy).
Description:
I figured out that I can add keep_alive<1,2> to the extra flag (that will be correctly added to the setter) but I'm assuming this will keep all entries in the list alive. Is there any workaround for this?
In other cases I used weakref and my own ref counting as mentioned in the documentation but here I don't have access to the pybind11::object self to use to setup the weakref. Is there some way of only keeping certain objects in the list alive?
I tried calling something like pybind11::handle/object h = t[1]; h.dec_ref() but that segfaulted.
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.
-
Issue:
In an example setter I get a
pybind11:list
with two entries, the first has to be kept alive the other arguments need to be garbage collected (large bytestream that I copy).Description:
I figured out that I can add
keep_alive<1,2>
to theextra
flag (that will be correctly added to thesetter
) but I'm assuming this will keep all entries in the list alive. Is there any workaround for this?In other cases I used
weakref
and my own ref counting as mentioned in the documentation but here I don't have access to thepybind11::object self
to use to setup theweakref
. Is there some way of only keeping certain objects in the list alive?I tried calling something like
pybind11::handle/object h = t[1]; h.dec_ref()
but that segfaulted.Thanks for any help!
Beta Was this translation helpful? Give feedback.
All reactions