[geos-devel] WKTReader and python bindings

Howard Butler hobu at iastate.edu
Fri Mar 10 00:24:06 EST 2006


John,

SWIG's __del__ implementation is biting you here.  In the second 
example, the geos.GeometryFactory() goes out of scope and a reference 
isn't kept alive by Python.  The GDAL guys tease me by calling this 
incantination a "hobuism" because I like to chain things together 
like this in Python (that's what it's for, right :)

My only fix for this in the 2.2 series was to go through the geos.py 
and comment out all of the __del__ implementations and let it leak.

Howard

At 10:19 PM -0700 3/9/06, John Cartwright wrote:
>Hello All,
>
>I'm using the python bindings for version 2.2.1 and am surprised to 
>find that while
>
>gf = geos.GeometryFactory()
>reader = geos.WKTReader(gf)
>reader.read(wkt)
>
>works fine, the code below segfaults.
>
>reader = geos.WKTReader(geos.GeometryFactory())
>geom = reader.read(wkt)
>
>I would have thought the two code snippets would behave identically 
>- can someone explain why not?
>
>Thanks!
>
>-- john
>
>_______________________________________________
>geos-devel mailing list
>geos-devel at geos.refractions.net
>http://geos.refractions.net/mailman/listinfo/geos-devel




More information about the geos-devel mailing list