Skip to content

Commit f7dbc05

Browse files
committed
more python 2 removal
1 parent ef3b665 commit f7dbc05

2 files changed

Lines changed: 8 additions & 63 deletions

File tree

‎python/core/conversions.sip‎

Lines changed: 7 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ which are not wrapped by PyQt:
2424

2525
%ModuleHeaderCode
2626

27-
// From Python 2.5, some functions use Py_ssize_t instead of int
28-
// thus this typedef is for maintaining backward compatibility
29-
// for older versions of Python
30-
#if (PY_VERSION_HEX < 0x02050000)
31-
typedef int Py_ssize_t;
32-
#endif
33-
3427
%End
3528

3629

@@ -766,9 +759,6 @@ template<TYPE>
766759

767760

768761

769-
770-
771-
772762
%MappedType QMap<QString, QVariant::Type>
773763
{
774764
%TypeHeaderCode
@@ -820,12 +810,7 @@ template<TYPE>
820810

821811
%ConvertToTypeCode
822812
PyObject *t1obj, *t2obj;
823-
#if PY_VERSION_HEX >= 0x02050000
824813
Py_ssize_t i = 0;
825-
#else
826-
int i = 0;
827-
#endif
828-
829814

830815
// Check the type if that is all that is required.
831816
if (sipIsErr == NULL)
@@ -922,12 +907,7 @@ template<TYPE>
922907

923908
%ConvertToTypeCode
924909
PyObject *t1obj, *t2obj;
925-
#if PY_VERSION_HEX >= 0x02050000
926910
Py_ssize_t i = 0;
927-
#else
928-
int i = 0;
929-
#endif
930-
931911

932912
// Check the type if that is all that is required.
933913
if (sipIsErr == NULL)
@@ -1026,11 +1006,7 @@ template<TYPE1, TYPE2>
10261006

10271007
%ConvertToTypeCode
10281008
PyObject *t1obj, *t2obj;
1029-
#if PY_VERSION_HEX >= 0x02050000
10301009
Py_ssize_t i = 0;
1031-
#else
1032-
int i = 0;
1033-
#endif
10341010

10351011
// Check the type if that is all that is required.
10361012
if (sipIsErr == NULL)
@@ -1127,11 +1103,7 @@ template<double, TYPE>
11271103

11281104
%ConvertToTypeCode
11291105
PyObject *t1obj, *t2obj;
1130-
#if PY_VERSION_HEX >= 0x02050000
11311106
Py_ssize_t i = 0;
1132-
#else
1133-
int i = 0;
1134-
#endif
11351107

11361108
// Check the type if that is all that is required.
11371109
if (sipIsErr == NULL)
@@ -1240,11 +1212,7 @@ template<double, TYPE2>
12401212

12411213
%ConvertToTypeCode
12421214
PyObject *t1obj, *t2obj;
1243-
#if PY_VERSION_HEX >= 0x02050000
12441215
Py_ssize_t i = 0;
1245-
#else
1246-
int i = 0;
1247-
#endif
12481216

12491217
// Check the type if that is all that is required.
12501218
if (sipIsErr == NULL)
@@ -1323,11 +1291,7 @@ template<int, TYPE2*>
13231291

13241292
const int t1 = i.key();
13251293
TYPE2 * t2 = i.value();
1326-
#if (PY_VERSION_HEX < 0x03000000)
1327-
PyObject *t1obj = PyInt_FromSize_t(t1);
1328-
#else
13291294
PyObject *t1obj = PyLong_FromSize_t(t1);
1330-
#endif
13311295
PyObject *t2obj = sipConvertFromType(t2, sipType_TYPE2, sipTransferObj);
13321296
if (PyDict_GetItem(d, t1obj) == NULL)
13331297
{
@@ -1367,11 +1331,7 @@ template<int, TYPE2*>
13671331
%ConvertToTypeCode
13681332
// Convert from Python:
13691333
PyObject *t1obj, *t2obj;
1370-
#if PY_VERSION_HEX >= 0x02050000
13711334
Py_ssize_t i = 0;
1372-
#else
1373-
int i = 0;
1374-
#endif
13751335

13761336
// Check the type if that is all that is required.
13771337
if (sipIsErr == NULL)
@@ -1473,12 +1433,10 @@ template<int, TYPE2*>
14731433

14741434
return d;
14751435
%End
1436+
14761437
%ConvertToTypeCode
1477-
#if PY_VERSION_HEX >= 0x02050000
14781438
Py_ssize_t i = 0;
1479-
#else
1480-
int i = 0;
1481-
#endif
1439+
14821440
QList < QPair< QString, QList<QString> > > *qm = new QList < QPair< QString, QList<QString> > >;
14831441

14841442
for ( i = 0; i < PyList_GET_SIZE(sipPy); i++ )
@@ -1542,12 +1500,10 @@ template<int, TYPE2*>
15421500

15431501
return d;
15441502
%End
1503+
15451504
%ConvertToTypeCode
1546-
#if PY_VERSION_HEX >= 0x02050000
15471505
Py_ssize_t i = 0;
1548-
#else
1549-
int i = 0;
1550-
#endif
1506+
15511507
QList < QPair< QString, double > > *qm = new QList< QPair< QString, double > >;
15521508

15531509
for ( i = 0; i < PyList_GET_SIZE(sipPy); i++ )
@@ -1603,12 +1559,10 @@ template<int, TYPE2*>
16031559

16041560
return d;
16051561
%End
1562+
16061563
%ConvertToTypeCode
1607-
#if PY_VERSION_HEX >= 0x02050000
16081564
Py_ssize_t i = 0;
1609-
#else
1610-
int i = 0;
1611-
#endif
1565+
16121566
QList < QPair< QgsVectorLayer *, int > > *qm = new QList< QPair< QgsVectorLayer *, int > >;
16131567

16141568
for ( i = 0; i < PyList_GET_SIZE(sipPy); i++ )
@@ -1755,13 +1709,10 @@ template <TYPE>
17551709
return d;
17561710

17571711
%End
1712+
17581713
%ConvertToTypeCode
17591714
PyObject *t1obj, *t2obj;
1760-
#if PY_VERSION_HEX >= 0x02050000
17611715
Py_ssize_t i = 0;
1762-
#else
1763-
int i = 0;
1764-
#endif
17651716

17661717
QMap<qint64, QgsFeature*> *qm = new QMap<qint64, QgsFeature*>;
17671718

‎python/ext-libs/pyspatialite/src/sqlitecompat.h‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/* sqlitecompat.h - compatibility macros
23
*
34
* Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de>
@@ -26,13 +27,6 @@
2627
#ifndef PYSQLITE_COMPAT_H
2728
#define PYSQLITE_COMPAT_H
2829

29-
/* define Py_ssize_t for pre-2.5 versions of Python */
30-
31-
#if PY_VERSION_HEX < 0x02050000
32-
typedef int Py_ssize_t;
33-
typedef int (*lenfunc)(PyObject*);
34-
#endif
35-
3630

3731
/* define PyDict_CheckExact for pre-2.4 versions of Python */
3832
#ifndef PyDict_CheckExact

0 commit comments

Comments
 (0)