Line 0
Link Here
|
|
|
1 |
--- openvdb/python/pyOpenVDBModule.cc.orig |
2 |
+++ openvdb/python/pyOpenVDBModule.cc |
3 |
@@ -320,7 +320,11 @@ |
4 |
/// @return nullptr if the given Python object is not convertible to the PointIndex. |
5 |
static void* convertible(PyObject* obj) |
6 |
{ |
7 |
+#if PY_MAJOR_VERSION >= 3 |
8 |
+ if (!PyLong_Check(obj)) return nullptr; // not a Python integer |
9 |
+#else |
10 |
if (!PyInt_Check(obj)) return nullptr; // not a Python integer |
11 |
+#endif |
12 |
return obj; |
13 |
} |
14 |
|
15 |
@@ -337,7 +341,11 @@ |
16 |
// Extract the PointIndex from the python integer |
17 |
PointIndexT* index = static_cast<PointIndexT*>(storage); |
18 |
|
19 |
+#if PY_MAJOR_VERSION >= 3 |
20 |
+ *index = static_cast<IntType>(PyLong_AsLong(obj)); |
21 |
+#else |
22 |
*index = static_cast<IntType>(PyInt_AsLong(obj)); |
23 |
+#endif |
24 |
} |
25 |
|
26 |
/// Register both the PointIndex-to-integer and the integer-to-PointIndex converters. |