summaryrefslogtreecommitdiff
path: root/python/_remctlmodule.c
diff options
context:
space:
mode:
authorRuss Allbery <rra@stanford.edu>2008-08-25 20:05:04 -0700
committerRuss Allbery <rra@stanford.edu>2008-08-25 20:05:04 -0700
commit0d55e1421bc26468a8d87841ca1d3a241a141e09 (patch)
tree3f9970bb7881ffdf58d5d5f71421982b75914771 /python/_remctlmodule.c
parentac4210ee48568bb3640322ceefe1fa7d62d6827c (diff)
Python: allow for Py_ssize_t not being present
Py_ssize_t was added in Python 2.5 as the type of the argument to PyString_AsStringAndSize. Prior to that, the argument type was an int *. Adjust for this by defining Py_ssize_t to int on older versions of Python.
Diffstat (limited to 'python/_remctlmodule.c')
-rw-r--r--python/_remctlmodule.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/python/_remctlmodule.c b/python/_remctlmodule.c
index fc27c12..f0e3e10 100644
--- a/python/_remctlmodule.c
+++ b/python/_remctlmodule.c
@@ -34,6 +34,11 @@
#include <remctl.h>
+/* The type of the argument to PyString_AsStringAndSize changed in 2.5. */
+#if (PY_MAJOR_VERSION < 2) || ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 5))
+# define Py_ssize_t int
+#endif
+
/* Silence GCC warnings. */
PyMODINIT_FUNC init_remctl(void);