Skip to content

Commit 87bcc01

Browse files
author
wonder
committedMay 10, 2007
Fixed compatibility with (some versions of) Python 2.5.
Also should stay compatible with older python versions. git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@6941 c8812cc2-4d05-0410-92ff-de0c093fc19c

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed
 

‎python/core/qgsvectordataprovider.sip

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11

2+
%ModuleHeaderCode
3+
// From Python 2.5, some functions use Py_ssize_t instead of int
4+
// thus this typedef is for maintaining backward compatibility
5+
// for older versions of Python
6+
#if (PY_VERSION_HEX < 0x02050000)
7+
typedef int Py_ssize_t;
8+
#endif
9+
%End
210

311
%MappedType QSet<int>
412
{
@@ -104,13 +112,13 @@ template<TYPE>
104112
if (!PyDict_Check(sipPy))
105113
return 0;
106114

107-
int i = 0;
115+
Py_ssize_t i = 0;
108116
while (PyDict_Next(sipPy, &i, &kobj, &tobj))
109117
{
110118
if (!PyDict_Check(tobj))
111119
return 0;
112120

113-
int j = 0;
121+
Py_ssize_t j = 0;
114122
while (PyDict_Next(tobj, &j, &kobj2, &tobj2))
115123
{
116124
if (!sipCanConvertToInstance(tobj2, sipClass_TYPE, SIP_NOT_NONE))
@@ -124,7 +132,7 @@ template<TYPE>
124132
QMap<int, QMap<int, TYPE> > *qm = new QMap<int, QMap<int, TYPE> >;
125133

126134

127-
int i = 0;
135+
Py_ssize_t i = 0;
128136
while (PyDict_Next(sipPy, &i, &kobj, &tobj))
129137
{
130138
int k = PyInt_AsLong(kobj);
@@ -134,7 +142,7 @@ template<TYPE>
134142

135143
QMap<int, TYPE> qm2;
136144

137-
int j = 0;
145+
Py_ssize_t j = 0;
138146
while (PyDict_Next(tobj, &j, &kobj2, &tobj2))
139147
{
140148
int k2 = PyInt_AsLong(kobj2);

0 commit comments

Comments
 (0)
Please sign in to comment.