diff options
Diffstat (limited to 'misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc')
-rw-r--r-- | misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc b/misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc new file mode 100644 index 000000000000..70c0ef90a862 --- /dev/null +++ b/misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc @@ -0,0 +1,26 @@ +--- openvdb/python/pyOpenVDBModule.cc.orig 2019-05-07 20:58:35 UTC ++++ openvdb/python/pyOpenVDBModule.cc +@@ -320,7 +320,11 @@ struct PointIndexConverter + /// @return nullptr if the given Python object is not convertible to the PointIndex. + static void* convertible(PyObject* obj) + { ++#if PY_MAJOR_VERSION >= 3 ++ if (!PyLong_Check(obj)) return nullptr; // not a Python integer ++#else + if (!PyInt_Check(obj)) return nullptr; // not a Python integer ++#endif + return obj; + } + +@@ -337,7 +341,11 @@ struct PointIndexConverter + // Extract the PointIndex from the python integer + PointIndexT* index = static_cast<PointIndexT*>(storage); + ++#if PY_MAJOR_VERSION >= 3 ++ *index = static_cast<IntType>(PyLong_AsLong(obj)); ++#else + *index = static_cast<IntType>(PyInt_AsLong(obj)); ++#endif + } + + /// Register both the PointIndex-to-integer and the integer-to-PointIndex converters. |