py3: ported Part to python3

This commit is contained in:
wmayer
2016-01-23 15:29:36 +01:00
committed by looooo
parent a1b58f45b2
commit d5e9afa52b
18 changed files with 177 additions and 97 deletions

View File

@@ -412,10 +412,17 @@ PyObject* TopoShapeEdgePy::discretize(PyObject *args, PyObject *kwds)
// use no kwds
PyObject* dist_or_num;
if (PyArg_ParseTuple(args, "O", &dist_or_num)) {
#if PY_MAJOR_VERSION >= 3
if (PyLong_Check(dist_or_num)) {
numPoints = PyLong_AsLong(dist_or_num);
uniformAbscissaPoints = true;
}
#else
if (PyInt_Check(dist_or_num)) {
numPoints = PyInt_AsLong(dist_or_num);
uniformAbscissaPoints = true;
}
#endif
else if (PyFloat_Check(dist_or_num)) {
distance = PyFloat_AsDouble(dist_or_num);
uniformAbscissaDistance = true;