Skip to content

Commit

Permalink
Fixed compatibility with (some versions of) Python 2.5.
Browse files Browse the repository at this point in the history
Also should stay compatible with older python versions.


git-svn-id: http://svn.osgeo.org/qgis/trunk@6941 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed May 10, 2007
1 parent 213e4d4 commit b93ef15
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions python/core/qgsvectordataprovider.sip
@@ -1,4 +1,12 @@

%ModuleHeaderCode
// From Python 2.5, some functions use Py_ssize_t instead of int
// thus this typedef is for maintaining backward compatibility
// for older versions of Python
#if (PY_VERSION_HEX < 0x02050000)
typedef int Py_ssize_t;
#endif
%End

%MappedType QSet<int>
{
Expand Down Expand Up @@ -104,13 +112,13 @@ template<TYPE>
if (!PyDict_Check(sipPy))
return 0;

int i = 0;
Py_ssize_t i = 0;
while (PyDict_Next(sipPy, &i, &kobj, &tobj))
{
if (!PyDict_Check(tobj))
return 0;

int j = 0;
Py_ssize_t j = 0;
while (PyDict_Next(tobj, &j, &kobj2, &tobj2))
{
if (!sipCanConvertToInstance(tobj2, sipClass_TYPE, SIP_NOT_NONE))
Expand All @@ -124,7 +132,7 @@ template<TYPE>
QMap<int, QMap<int, TYPE> > *qm = new QMap<int, QMap<int, TYPE> >;


int i = 0;
Py_ssize_t i = 0;
while (PyDict_Next(sipPy, &i, &kobj, &tobj))
{
int k = PyInt_AsLong(kobj);
Expand All @@ -134,7 +142,7 @@ template<TYPE>

QMap<int, TYPE> qm2;

int j = 0;
Py_ssize_t j = 0;
while (PyDict_Next(tobj, &j, &kobj2, &tobj2))
{
int k2 = PyInt_AsLong(kobj2);
Expand Down

0 comments on commit b93ef15

Please sign in to comment.