From 5687b337f94f096d4233fbdec09df3bf2ee69462 Mon Sep 17 00:00:00 2001 From: Dean Moldovan Date: Mon, 27 Feb 2017 23:39:26 +0100 Subject: [PATCH] Fix negative refcount in PyCapsule destructor --- include/pybind11/eigen.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/pybind11/eigen.h b/include/pybind11/eigen.h index 5ffbc7e09..2aefcd33b 100644 --- a/include/pybind11/eigen.h +++ b/include/pybind11/eigen.h @@ -229,7 +229,7 @@ handle eigen_ref_array(Type &src, handle parent = none()) { // not the Type of the pointer given is const. template ::value>> handle eigen_encapsulate(Type *src) { - capsule base(src, [](PyObject *o) { delete reinterpret_steal(o).operator Type*(); }); + capsule base(src, [](PyObject *o) { delete static_cast(PyCapsule_GetPointer(o, nullptr)); }); return eigen_ref_array(*src, base); }