gdal/0001-Replace-SWIG-Python-obj0-swig_obj-0-with-version-agn.patch
Angelos Tzotsos 68836d9329 Accepting request 746075 from home:LPechacek:branches:Application:Geo
This is GDAL update to 3.0.2. Seeing that there have been build errors today, I gave a shot to taking GDAL to the latest released version. The previous build failure on openSUSE_Tumbleweed i586 is gone and the remaining failures seem to be the same as before. With that I'm offering the upgrade for inclusion.

OBS-URL: https://build.opensuse.org/request/show/746075
OBS-URL: https://build.opensuse.org/package/show/Application:Geo/gdal?expand=0&rev=104
2019-11-06 20:44:40 +00:00

67 lines
2.2 KiB
Diff

From 8f52960e1c6f2fde21fbc3cfe8064af84f90a09d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Thu, 5 Sep 2019 20:05:53 +0200
Git-id: 8328ae3077aea7e54537d76a9a8193775ddc8b09
Subject: [PATCH] Replace SWIG Python obj0/swig_obj[0] with version agnostic
$self
"obj0" was only meant as a porting helper and should not be used, even
with swig 3.0, see swig/swig@cd8fc0a.
Use the correct "$self" notation, which is expanded to the correct
code regardless of swig version and options.
Acked-by: Libor Pechacek <lpechacek@gmx.com>
---
swig/include/gdal_array.i | 12 +++---------
swig/include/python/typemaps_python.i | 8 +-------
2 files changed, 4 insertions(+), 16 deletions(-)
diff --git a/swig/include/gdal_array.i b/swig/include/gdal_array.i
index d86491d1d45e..6ee34b9abd99 100644
--- a/swig/include/gdal_array.i
+++ b/swig/include/gdal_array.i
@@ -913,18 +913,12 @@ retStringAndCPLFree* GetArrayFilename(PyArrayObject *psArray)
}
/* Keep a reference to the VirtualMem object */
-%#if SWIGVERSION >= 0x040000
-%#define obj0 swig_obj[0]
-%#endif
%#if NPY_API_VERSION >= 0x00000007
- PyArray_SetBaseObject(ar, obj0);
+ PyArray_SetBaseObject(ar, $self);
%#else
- PyArray_BASE(ar) = obj0;
-%#endif
- Py_INCREF(obj0);
-%#if SWIGVERSION >= 0x040000
-%#undef obj0
+ PyArray_BASE(ar) = $self;
%#endif
+ Py_INCREF($self);
Py_DECREF($result);
$result = (PyObject*) ar;
}
diff --git a/swig/include/python/typemaps_python.i b/swig/include/python/typemaps_python.i
index 85a25b5a3099..2af8b51c6368 100644
--- a/swig/include/python/typemaps_python.i
+++ b/swig/include/python/typemaps_python.i
@@ -2067,13 +2067,7 @@ DecomposeSequenceOf4DCoordinates( PyObject *seq, int nCount, double *x, double *
/* %typemap(argout) (void** pptr, size_t* pnsize, GDALDataType* pdatatype, int* preadonly)*/
Py_buffer *buf=(Py_buffer*)malloc(sizeof(Py_buffer));
- if (PyBuffer_FillInfo(buf,
-%#if SWIGVERSION >= 0x040000
- swig_obj[0],
-%#else
- obj0,
-%#endif
- *($1), *($2), *($4), PyBUF_ND)) {
+ if (PyBuffer_FillInfo(buf, $self, *($1), *($2), *($4), PyBUF_ND)) {
// error, handle
}
if( *($3) == GDT_Byte )
--
2.23.0