Skip to content

Commit

Permalink
more python 2 removal
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids committed Jan 24, 2017
1 parent ef3b665 commit f7dbc05
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 63 deletions.
63 changes: 7 additions & 56 deletions python/core/conversions.sip
Expand Up @@ -24,13 +24,6 @@ which are not wrapped by PyQt:

%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


Expand Down Expand Up @@ -766,9 +759,6 @@ template<TYPE>






%MappedType QMap<QString, QVariant::Type>
{
%TypeHeaderCode
Expand Down Expand Up @@ -820,12 +810,7 @@ template<TYPE>

%ConvertToTypeCode
PyObject *t1obj, *t2obj;
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif


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

%ConvertToTypeCode
PyObject *t1obj, *t2obj;
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif


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

%ConvertToTypeCode
PyObject *t1obj, *t2obj;
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif

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

%ConvertToTypeCode
PyObject *t1obj, *t2obj;
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif

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

%ConvertToTypeCode
PyObject *t1obj, *t2obj;
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif

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

const int t1 = i.key();
TYPE2 * t2 = i.value();
#if (PY_VERSION_HEX < 0x03000000)
PyObject *t1obj = PyInt_FromSize_t(t1);
#else
PyObject *t1obj = PyLong_FromSize_t(t1);
#endif
PyObject *t2obj = sipConvertFromType(t2, sipType_TYPE2, sipTransferObj);
if (PyDict_GetItem(d, t1obj) == NULL)
{
Expand Down Expand Up @@ -1367,11 +1331,7 @@ template<int, TYPE2*>
%ConvertToTypeCode
// Convert from Python:
PyObject *t1obj, *t2obj;
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif

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

return d;
%End

%ConvertToTypeCode
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif

QList < QPair< QString, QList<QString> > > *qm = new QList < QPair< QString, QList<QString> > >;

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

return d;
%End

%ConvertToTypeCode
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif

QList < QPair< QString, double > > *qm = new QList< QPair< QString, double > >;

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

return d;
%End

%ConvertToTypeCode
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif

QList < QPair< QgsVectorLayer *, int > > *qm = new QList< QPair< QgsVectorLayer *, int > >;

for ( i = 0; i < PyList_GET_SIZE(sipPy); i++ )
Expand Down Expand Up @@ -1755,13 +1709,10 @@ template <TYPE>
return d;

%End

%ConvertToTypeCode
PyObject *t1obj, *t2obj;
#if PY_VERSION_HEX >= 0x02050000
Py_ssize_t i = 0;
#else
int i = 0;
#endif

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

Expand Down
8 changes: 1 addition & 7 deletions python/ext-libs/pyspatialite/src/sqlitecompat.h
@@ -1,3 +1,4 @@

/* sqlitecompat.h - compatibility macros
*
* Copyright (C) 2006-2010 Gerhard Häring <gh@ghaering.de>
Expand Down Expand Up @@ -26,13 +27,6 @@
#ifndef PYSQLITE_COMPAT_H
#define PYSQLITE_COMPAT_H

/* define Py_ssize_t for pre-2.5 versions of Python */

#if PY_VERSION_HEX < 0x02050000
typedef int Py_ssize_t;
typedef int (*lenfunc)(PyObject*);
#endif


/* define PyDict_CheckExact for pre-2.4 versions of Python */
#ifndef PyDict_CheckExact
Expand Down

0 comments on commit f7dbc05

Please sign in to comment.