updated on Mon Jan 16 12:07:49 UTC 2012
[aur-mirror.git] / lunatic-python-bzr / 1-pep-353.patch
blobf6b5708c74d21b01b6684619eca3fd7e61197f93
1 --- src/pythoninlua.c.orig 2011-07-23 17:25:28.552430739 +0600
2 +++ src/pythoninlua.c 2011-07-23 17:27:32.973047569 +0600
3 @@ -28,6 +28,13 @@
4 #include "pythoninlua.h"
5 #include "luainpython.h"
7 +/* Py_ssize_t introduced as index type in Python 2.5 (PEP 353) */
8 +#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
9 +typedef int Py_ssize_t;
10 +#define PY_SSIZE_T_MAX INT_MAX
11 +#define PY_SSIZE_T_MIN INT_MIN
12 +#endif
14 static int py_asfunc_call(lua_State *L);
16 static int py_convert_custom(lua_State *L, PyObject *o, int asindx)
17 @@ -70,7 +77,7 @@
18 lua_pushboolean(L, 0);
19 } else if (PyString_Check(o)) {
20 char *s;
21 - int len;
22 + Py_ssize_t len;
23 PyString_AsStringAndSize(o, &s, &len);
24 lua_pushlstring(L, s, len);
25 ret = 1;
26 @@ -334,7 +341,7 @@
27 PyErr_Clear();
28 } else {
29 char *s;
30 - int len;
31 + Py_ssize_t len;
32 PyString_AsStringAndSize(repr, &s, &len);
33 lua_pushlstring(L, s, len);
34 Py_DECREF(repr);