summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Lib/python/pyhead.swg5
-rw-r--r--Lib/python/pystrings.swg2
2 files changed, 6 insertions, 1 deletions
diff --git a/Lib/python/pyhead.swg b/Lib/python/pyhead.swg
index 20fa33c9f..c6d19c864 100644
--- a/Lib/python/pyhead.swg
+++ b/Lib/python/pyhead.swg
@@ -78,3 +78,8 @@ PyObject *PyBool_FromLong(long ok)
}
#endif
+/* Py_ssize_t for old Pythons */
+#if PY_VERSION_HEX < 0x02050000
+typedef int Py_ssize_t;
+#endif
+
diff --git a/Lib/python/pystrings.swg b/Lib/python/pystrings.swg
index 64172770f..d4d60c42b 100644
--- a/Lib/python/pystrings.swg
+++ b/Lib/python/pystrings.swg
@@ -6,7 +6,7 @@ SWIGINTERN int
SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
{
if (PyString_Check(obj)) {
- char *cstr; int len;
+ char *cstr; Py_ssize_t len;
PyString_AsStringAndSize(obj, &cstr, &len);
if (cptr) {
if (alloc) {