fix for old python versions

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@5803 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-03-30 08:05:29 +00:00
commit 7d119baa1f

View file

@ -13,13 +13,10 @@
/**** The PySequence C++ Wrap ***/
%{
%insert(header) %{
#if PY_VERSION_HEX < 0x02000000
#define PySequence_Size PySequence_Length
#endif
#if PY_VERSION_HEX < 0x02020000
#define PyObject_GetIter Py_INCREF
#endif
%}
%fragment("PySequence_Cont","header",
@ -565,9 +562,13 @@ namespace swigpy
for (int j = 0; j < pysize; ++i, ++j) {
PyList_SetItem(keyList, j, swigpy::from(i->first));
}
%#if PY_VERSION_HEX >= 0x02020000
PyObject* iter = PyObject_GetIter(keyList);
Py_DECREF(keyList);
return iter;
%#else
return keyList;
%#endif
}
}
%enddef