Opened 6 months ago

Closed 5 months ago

Last modified 5 months ago

#6749 closed defect (fixed)

SystemError raised by Python bindings on Python 3.5

Reported by: damienayers Owned by: hobu
Priority: normal Milestone: 2.2.0
Component: PythonBindings Version: 2.1.2
Severity: normal Keywords:
Cc:

Description

I seem to have encountered the issue described in swig/swig#567 in python 3.5

from osgeo import ogr

def make_geom():
    geom = ogr.Geometry(ogr.wkbPoint)
    geom.AddPoint_2D(0, 0)
    return geom

def gen_list(N):
    for i in range(N):
        geom = make_geom()
        yield i

N = 10
print('gen', list(gen_list(N)))

produces SystemError: <built-in function delete_Geometry> returned a result with an error set

The issue has been resolved in SWIG 3.0.8 but the bindings in the GDAL sources are generated with SWIG 2.0.12.

Regenerating the bindings with the latest SWIG resolves the issue, but also adds libpcre as a run-time dependency.

Change History (3)

comment:1 Changed 5 months ago by Even Rouault

Resolution: fixed
Status: newclosed

In 36845:

Regenerate Python bindings with SWIG 3.0.8 to avoid issue with Python 3.5. Add backward compatibility in Band.ComputeStatistics?() to accept 0/1 as input instead of the expected bool value (fixes #6749)

comment:2 Changed 5 months ago by Even Rouault

Milestone: 2.2.0

comment:3 Changed 5 months ago by Even Rouault

In 36846:

Add new test step to test issue with Python 3.5 and older SWIG (refs #6749)

Note: See TracTickets for help on using tickets.