View | Details | Raw Unified | Return to bug 244347
Collapse All | Expand All

(-)misc/openvdb/files/patch-openvdb_python_pyOpenVDBModule.cc (+26 lines)
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.
(-)misc/openvdb/Makefile (-1 / +1 lines)
Lines 28-34 Link Here
28
OPTIONS_DEFAULT=	PYTHON TOOLS
28
OPTIONS_DEFAULT=	PYTHON TOOLS
29
OPTIONS_SUB=		yes
29
OPTIONS_SUB=		yes
30
30
31
PYTHON_USES=		python:2.7 # 3.6 is broken: https://github.com/AcademySoftwareFoundation/openvdb/issues/427
31
PYTHON_USES=		python
32
PYTHON_CMAKE_BOOL=	OPENVDB_BUILD_PYTHON_MODULE
32
PYTHON_CMAKE_BOOL=	OPENVDB_BUILD_PYTHON_MODULE
33
PYTHON_CMAKE_ON=	-DFREEBSD_PYTHON_VER:STRING=${PYTHON_VER} -DUSE_NUMPY:BOOL=ON
33
PYTHON_CMAKE_ON=	-DFREEBSD_PYTHON_VER:STRING=${PYTHON_VER} -DUSE_NUMPY:BOOL=ON
34
PYTHON_LIB_DEPENDS=	${PY_BOOST}
34
PYTHON_LIB_DEPENDS=	${PY_BOOST}

Return to bug 244347