Improve how/when we define Py_ssize_t to match the way the python developers

recommend, so that it works if the user includes headers from something like
numpy which also defines Py_ssize_t.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9546 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2006-11-12 01:33:58 +00:00
commit b0fe47a4dd

View file

@ -79,7 +79,10 @@ PyObject *PyBool_FromLong(long ok)
#endif
/* Py_ssize_t for old Pythons */
#if PY_VERSION_HEX < 0x02050000
/* This code is as recommended by: */
/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
typedef int Py_ssize_t;
# define PY_SSIZE_T_MAX INT_MAX
# define PY_SSIZE_T_MIN INT_MIN
#endif