Skip to content
Snippets Groups Projects
Commit 274d09b5 authored by Joseph Mirabel's avatar Joseph Mirabel
Browse files

Fix deletion of NumPy for Python 3 only.

parent a3c82106
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@
#include "eigenpy/fwd.hpp"
#include <patchlevel.h> // For PY_MAJOR_VERSION
#include <numpy/arrayobject.h>
#include <iostream>
......@@ -93,9 +94,11 @@ namespace eigenpy
NumpyType()
{
pyModule = bp::import("numpy");
#if PY_MAJOR_VERSION >= 3
// TODO I don't know why this Py_INCREF is necessary.
// Without it, the destructor of NumpyType SEGV sometimes.
Py_INCREF(pyModule.ptr());
#endif
NumpyMatrixObject = pyModule.attr("matrix");
NumpyMatrixType = reinterpret_cast<PyTypeObject*>(NumpyMatrixObject.ptr());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment