summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKevin Greenan <kmg@box.com>2015-08-11 09:32:12 -0700
committerKevin Greenan <kmg@box.com>2015-08-11 09:32:12 -0700
commit8c825a8e2a39beefc4a73116f381de45e3615638 (patch)
treec618f910c0cb82941c69c3b62e3b4bb4879441d6 /src
parent4116b81e769617c79482feb8ff8a227b3d527044 (diff)
downloadpyeclib-8c825a8e2a39beefc4a73116f381de45e3615638.tar.gz
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.
Diffstat (limited to 'src')
-rw-r--r--src/c/pyeclib_c/pyeclib_c.c4
1 files changed, 2 insertions, 2 deletions
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