Commit 5687b337 by Dean Moldovan Committed by Wenzel Jakob

Fix negative refcount in PyCapsule destructor

parent 620a808a
...@@ -229,7 +229,7 @@ handle eigen_ref_array(Type &src, handle parent = none()) { ...@@ -229,7 +229,7 @@ handle eigen_ref_array(Type &src, handle parent = none()) {
// not the Type of the pointer given is const. // not the Type of the pointer given is const.
template <typename props, typename Type, typename = enable_if_t<is_eigen_dense_plain<Type>::value>> template <typename props, typename Type, typename = enable_if_t<is_eigen_dense_plain<Type>::value>>
handle eigen_encapsulate(Type *src) { handle eigen_encapsulate(Type *src) {
capsule base(src, [](PyObject *o) { delete reinterpret_steal<capsule>(o).operator Type*(); }); capsule base(src, [](PyObject *o) { delete static_cast<Type *>(PyCapsule_GetPointer(o, nullptr)); });
return eigen_ref_array<props>(*src, base); return eigen_ref_array<props>(*src, base);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment