Merge pull request #111 from longjon/python2

Support Python 2.7
This commit is contained in:
Syoyo Fujita
2016-12-06 14:37:05 +09:00
committed by GitHub
2 changed files with 12 additions and 2 deletions

View File

@@ -1,3 +1,2 @@
* PBR material
* Define index_t struct
* Python 2.7 binding

View File

@@ -1,4 +1,4 @@
// python3 module for tinyobjloader
// python2/3 module for tinyobjloader
//
// usage:
// import tinyobjloader as tol
@@ -183,10 +183,21 @@ static PyMethodDef mMethods[] = {
};
#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef moduledef = {PyModuleDef_HEAD_INIT, "tinyobjloader",
NULL, -1, mMethods};
PyMODINIT_FUNC PyInit_tinyobjloader(void) {
return PyModule_Create(&moduledef);
}
#else
PyMODINIT_FUNC inittinyobjloader(void) {
Py_InitModule3("tinyobjloader", mMethods, NULL);
}
#endif // PY_MAJOR_VERSION >= 3
}