py3: ported Path to python3

This commit is contained in:
wmayer
2016-01-23 21:59:22 +01:00
committed by looooo
parent 71f6a289c6
commit 32bacd0b63
6 changed files with 70 additions and 8 deletions

View File

@@ -112,9 +112,9 @@ Py::Float PathPy::getLength(void) const
return Py::Float(getToolpathPtr()->getLength());
}
Py::Int PathPy::getSize(void) const
Py::Long PathPy::getSize(void) const
{
return Py::Int((int)getToolpathPtr()->getSize());
return Py::Long((long)getToolpathPtr()->getSize());
}
// specific methods
@@ -178,7 +178,11 @@ PyObject* PathPy::toGCode(PyObject * args)
{
if (PyArg_ParseTuple(args, "")) {
std::string result = getToolpathPtr()->toGCode();
#if PY_MAJOR_VERSION >= 3
return PyBytes_FromString(result.c_str());
#else
return PyString_FromString(result.c_str());
#endif
}
throw Py::Exception("This method accepts no argument");
}