Skip to content

Commit

Permalink
py3: ported Points to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Feb 28, 2017
1 parent 5f5797e commit e90ddef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Mod/Points/App/PointsPy.xml
Expand Up @@ -58,7 +58,7 @@ transforming and much more.
<Documentation>
<UserDocu>Return the number of vertices of the points object.</UserDocu>
</Documentation>
<Parameter Name="CountPoints" Type="Int" />
<Parameter Name="CountPoints" Type="Long" />
</Attribute>
<Attribute Name="Points" ReadOnly="true">
<Documentation>
Expand Down
14 changes: 10 additions & 4 deletions src/Mod/Points/App/PointsPyImp.cpp
Expand Up @@ -67,9 +67,15 @@ int PointsPy::PyInit(PyObject* args, PyObject* /*kwd*/)
if (!addPoints(args))
return -1;
}
#if PY_MAJOR_VERSION >= 3
else if (PyUnicode_Check(pcObj)) {
getPointKernelPtr()->load(PyUnicode_AsUTF8(pcObj));
}
#else
else if (PyString_Check(pcObj)) {
getPointKernelPtr()->load(PyString_AsString(pcObj));
}
#endif
else {
PyErr_SetString(PyExc_TypeError, "optional argument must be list, tuple or string");
return -1;
Expand Down Expand Up @@ -168,7 +174,7 @@ PyObject* PointsPy::addPoints(PyObject * args)

Py_Return;
}


PyObject* PointsPy::fromSegment(PyObject * args)
{
PyObject *obj;
Expand Down Expand Up @@ -216,10 +222,10 @@ PyObject* PointsPy::fromValid(PyObject * args)
return 0;
}
}

Py::Int PointsPy::getCountPoints(void) const

Py::Long PointsPy::getCountPoints(void) const
{
return Py::Int((long)getPointKernelPtr()->size());
return Py::Long((long)getPointKernelPtr()->size());
}

Py::List PointsPy::getPoints(void) const
Expand Down

0 comments on commit e90ddef

Please sign in to comment.