diff --git a/src/Mod/Points/App/AppPoints.cpp b/src/Mod/Points/App/AppPoints.cpp index 1343099ba..f7773fb3f 100644 --- a/src/Mod/Points/App/AppPoints.cpp +++ b/src/Mod/Points/App/AppPoints.cpp @@ -60,5 +60,6 @@ PyMOD_INIT_FUNC(Points) Points::Structured ::init(); Points::FeatureCustom ::init(); Points::StructuredCustom ::init(); - Points::FeaturePython ::init(); + Points::FeaturePython ::init(); + PyMOD_Return(pointsModule); } diff --git a/src/Mod/Points/App/PointsPyImp.cpp b/src/Mod/Points/App/PointsPyImp.cpp index f4f21d04e..e0768e373 100644 --- a/src/Mod/Points/App/PointsPyImp.cpp +++ b/src/Mod/Points/App/PointsPyImp.cpp @@ -174,7 +174,7 @@ PyObject* PointsPy::addPoints(PyObject * args) Py_Return; } - + PyObject* PointsPy::fromSegment(PyObject * args) { PyObject *obj; @@ -188,7 +188,11 @@ PyObject* PointsPy::fromSegment(PyObject * args) pts->reserve(list.size()); int numPoints = static_cast(points->size()); for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) { +#if PY_MAJOR_VERSION < 3 int index = static_cast(Py::Int(*it)); +#else + long index = static_cast(Py::Long(*it)); +#endif if (index >= 0 && index < numPoints) pts->push_back(points->getPoint(index)); } @@ -222,10 +226,16 @@ PyObject* PointsPy::fromValid(PyObject * args) return 0; } } - -Py::Long PointsPy::getCountPoints(void) const + +#if PY_MAJOR_VERSION >= 3 +Py::Long PointsPy::getCountPoints(void) const { return Py::Long((long)getPointKernelPtr()->size()); +#else +Py::Int PointsPy::getCountPoints(void) const +{ + return Py::Int((long)getPointKernelPtr()->size()); +#endif } Py::List PointsPy::getPoints(void) const