From 8c825a8e2a39beefc4a73116f381de45e3615638 Mon Sep 17 00:00:00 2001 From: Kevin Greenan Date: Tue, 11 Aug 2015 09:32:12 -0700 Subject: Fix integer truncation issue with PyBuildValue on Big Endian systems by explicitly casting the size argument passed in to Py_ssize_t. Also fix import issue with the API test where older versions of Python fail to import. --- src/c/pyeclib_c/pyeclib_c.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/c/pyeclib_c/pyeclib_c.c b/src/c/pyeclib_c/pyeclib_c.c index 6ba83a9..e2d98c3 100644 --- a/src/c/pyeclib_c/pyeclib_c.c +++ b/src/c/pyeclib_c/pyeclib_c.c @@ -46,7 +46,7 @@ PyModuleDef_HEAD_INIT, name, doc, -1, methods, }; \ ob = PyModule_Create(&moduledef); #define PY_BUILDVALUE_OBJ_LEN(obj, objlen) \ - Py_BuildValue("y#", obj, objlen) + Py_BuildValue("y#", obj, (Py_ssize_t)objlen) #define PyInt_FromLong PyLong_FromLong #define PyString_FromString PyUnicode_FromString #define ENCODE_ARGS "Oy#" @@ -58,7 +58,7 @@ #define MOD_DEF(ob, name, doc, methods) \ ob = Py_InitModule3(name, methods, doc); #define PY_BUILDVALUE_OBJ_LEN(obj, objlen) \ - Py_BuildValue("s#", obj, objlen) + Py_BuildValue("s#", obj, (Py_ssize_t)objlen) #define ENCODE_ARGS "Os#" #define GET_METADATA_ARGS "Os#i" #endif -- cgit v1.2.1