Skip to content

Commit

Permalink
py3: Mesh: fix py3 Long/Int problem with python2
Browse files Browse the repository at this point in the history
  • Loading branch information
looooo authored and wwmayer committed Feb 24, 2017
1 parent 6c8c3dc commit d5348c6
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 30 deletions.
7 changes: 1 addition & 6 deletions src/Mod/Mesh/App/FacetPyImp.cpp
Expand Up @@ -76,15 +76,10 @@ PyObject* FacetPy::unbound(PyObject *args)
getFacetPtr()->Mesh = 0;
Py_Return;
}
#if PY_MAJOR_VERSION >= 3

Py::Long FacetPy::getIndex(void) const
{
return Py::Long((long) getFacetPtr()->Index);
#else
Py::Int FacetPy::getIndex(void) const
{
return Py::Int((long) getFacetPtr()->Index);
#endif
}

Py::Boolean FacetPy::getBound(void) const
Expand Down
6 changes: 0 additions & 6 deletions src/Mod/Mesh/App/MeshPointPyImp.cpp
Expand Up @@ -100,15 +100,9 @@ PyObject* MeshPointPy::move(PyObject *args)
Py_Return;
}

#if PY_MAJOR_VERSION >= 3
Py::Long MeshPointPy::getIndex(void) const
{
return Py::Long((long) getMeshPointPtr()->Index);
#else
Py::Int MeshPointPy::getIndex(void) const
{
return Py::Int((long) getMeshPointPtr()->Index);
#endif
}

Py::Boolean MeshPointPy::getBound(void) const
Expand Down
18 changes: 1 addition & 17 deletions src/Mod/Mesh/App/MeshPyImp.cpp
Expand Up @@ -1766,7 +1766,7 @@ PyObject* MeshPy::getSegmentsByCurvature(PyObject *args)

return Py::new_reference_to(list);
}
#if PY_MAJOR_VERSION >= 3

Py::Long MeshPy::getCountPoints(void) const
{
return Py::Long((long)getMeshObjectPtr()->countPoints());
Expand All @@ -1781,22 +1781,6 @@ Py::Long MeshPy::getCountFacets(void) const
{
return Py::Long((long)getMeshObjectPtr()->countFacets());
}
#else
Py::Int MeshPy::getCountPoints(void) const
{
return Py::Int((long)getMeshObjectPtr()->countPoints());
}

Py::Int MeshPy::getCountEdges(void) const
{
return Py::Int((long)getMeshObjectPtr()->countEdges());
}

Py::Int MeshPy::getCountFacets(void) const
{
return Py::Int((long)getMeshObjectPtr()->countFacets());
}
#endif

Py::Float MeshPy::getArea(void) const
{
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/MeshPart/App/AppMeshPartPy.cpp
Expand Up @@ -150,7 +150,7 @@ class Module : public Py::ExtensionModule<Module>
std::vector<unsigned long> segm;
segm.reserve(list.size());
for (unsigned int i=0; i<list.size(); i++) {
segm.push_back((int)Py::Long(list[i]));
segm.push_back((long)Py::Long(list[i]));
}

std::list<std::vector<Base::Vector3f> > bounds;
Expand Down

0 comments on commit d5348c6

Please sign in to comment.