File tree 2 files changed +10
-6
lines changed 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -1371,6 +1371,7 @@ template <typename... Ts> class type_caster<std::tuple<Ts...>>
1371
1371
template <typename T>
1372
1372
struct holder_helper {
1373
1373
static auto get (const T &p) -> decltype(p.get()) { return p.get (); }
1374
+ static void release (T &p) { p.release (); }
1374
1375
};
1375
1376
1376
1377
// / Type caster for holder types like std::shared_ptr, etc.
Original file line number Diff line number Diff line change @@ -1516,15 +1516,18 @@ inline void consume_impl(handle consumed) {
1516
1516
if (consumed.is_none ())
1517
1517
return ; /* Nothing to consume */
1518
1518
1519
- // auto tinfo = all_type_info(Py_TYPE(consumed.ptr())); // ???
1519
+ auto inst = reinterpret_cast <detail::instance *>(consumed.ptr ());
1520
+ auto value_and_holder = values_and_holders (inst).begin ();
1520
1521
1521
- // consumed.dec_ref(); ???
1522
1522
1523
- // del the name of consumed from the Python scope somehow ...
1524
1523
1525
- auto inst = reinterpret_cast <detail::instance *>(consumed.ptr ());
1526
- auto &holder = values_and_holders (inst).begin ()->holder < std::unique_ptr <void *> >(); // holder_type ???
1527
- holder.release ();
1524
+ auto &holder = value_and_holder->holder < std::unique_ptr<void *> >(); // holder_type ???
1525
+
1526
+
1527
+ holder_helper<std::unique_ptr<void *>>::release (holder);
1528
+
1529
+ value_and_holder->set_holder_constructed (false );
1530
+ inst->owned = false ;
1528
1531
}
1529
1532
1530
1533
PYBIND11_NOINLINE inline void consume_impl (size_t Consumed, function_call &call) {
You can’t perform that action at this time.
0 commit comments