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:
parent
42b8dcaae1
commit
7d119baa1f
1 changed files with 5 additions and 4 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue