[geos-devel] WKTReader and python bindings

Ari Jolma ari.jolma at tkk.fi
Fri Mar 10 04:41:05 EST 2006


Howard Butler kirjoitti:
> 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 :)


I've been looking into adding Perl to the swigged GEOS interfaces (the
CVS code did not compile last time I tried so I postponed submitting my
code a bit). I'm definitely for allowing hobuisms in scripting
languages. I'm a bit disappointed we haven't been able to allow hobuisms
in GDAL.

Ari


> 
> 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
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel


-- 
Prof. Ari Jolma
Kartografia ja Geoinformatiikka / Cartography and Geoinformatics
Teknillinen Korkeakoulu / Helsinki University of Technology
tel: +358 9 451 3886 address: POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma



More information about the geos-devel mailing list