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); }