@@ -96,7 +96,7 @@ class DataSource(GDALBase):
def __del__(self):
"Destroys this DataStructure object."
- if self._ptr:
+ if self._ptr and capi:
capi.destroy_ds(self._ptr)
def __iter__(self):
@@ -34,7 +34,7 @@ class Feature(GDALBase):
"Releases a reference to this object."
capi.destroy_feature(self._ptr)
def __getitem__(self, index):
@@ -127,7 +127,7 @@ class OGRGeometry(GDALBase):
"Deletes this Geometry."
capi.destroy_geom(self._ptr)
# Pickle routines
@@ -97,7 +97,7 @@ class SpatialReference(GDALBase):
"Destroys this spatial reference."
capi.release_srs(self._ptr)
def __getitem__(self, target):
@@ -115,7 +115,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
Destroys this Geometry; in other words, frees the memory used by the
GEOS C++ object.
"""
def __copy__(self):
@@ -23,7 +23,7 @@ class PreparedGeometry(GEOSBase):
self.ptr = capi.geos_prepare(geom.ptr)
capi.prepared_destroy(self._ptr)
def contains(self, other):
@@ -12,7 +12,7 @@ class GEOSContextHandle(object):
self.ptr = lgeos.initGEOS_r(notice_h, error_h)
- if self.ptr:
+ if self.ptr and lgeos:
lgeos.finishGEOS_r(self.ptr)