fix for old python versions
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@5803 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
4a92e27318
commit
8f5e757867
1 changed files with 5 additions and 4 deletions
|
|
@ -13,13 +13,10 @@
|
||||||
|
|
||||||
/**** The PySequence C++ Wrap ***/
|
/**** The PySequence C++ Wrap ***/
|
||||||
|
|
||||||
%{
|
%insert(header) %{
|
||||||
#if PY_VERSION_HEX < 0x02000000
|
#if PY_VERSION_HEX < 0x02000000
|
||||||
#define PySequence_Size PySequence_Length
|
#define PySequence_Size PySequence_Length
|
||||||
#endif
|
#endif
|
||||||
#if PY_VERSION_HEX < 0x02020000
|
|
||||||
#define PyObject_GetIter Py_INCREF
|
|
||||||
#endif
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%fragment("PySequence_Cont","header",
|
%fragment("PySequence_Cont","header",
|
||||||
|
|
@ -565,9 +562,13 @@ namespace swigpy
|
||||||
for (int j = 0; j < pysize; ++i, ++j) {
|
for (int j = 0; j < pysize; ++i, ++j) {
|
||||||
PyList_SetItem(keyList, j, swigpy::from(i->first));
|
PyList_SetItem(keyList, j, swigpy::from(i->first));
|
||||||
}
|
}
|
||||||
|
%#if PY_VERSION_HEX >= 0x02020000
|
||||||
PyObject* iter = PyObject_GetIter(keyList);
|
PyObject* iter = PyObject_GetIter(keyList);
|
||||||
Py_DECREF(keyList);
|
Py_DECREF(keyList);
|
||||||
return iter;
|
return iter;
|
||||||
|
%#else
|
||||||
|
return keyList;
|
||||||
|
%#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
%enddef
|
%enddef
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue