Fixed #25657 -- Ignored exceptions when destroying geometry objects

Due to randomness of garbage collection with geometry objects, it's
easier to simply ignore AttributeError/TypeError generally raised when
parts of objects are already garbage-collected.
Thanks Sergey Fedoseev and Tim Graham for reviewing the patch.
This commit is contained in:
Claude Paroz 2015-12-06 17:28:39 +01:00
parent ec708803f7
commit cd40d9e721
8 changed files with 27 additions and 9 deletions

View file

@ -131,8 +131,10 @@ class GDALRaster(GDALBase):
raise GDALException('Invalid data source input type: "{}".'.format(type(ds_input)))
def __del__(self):
if self._ptr and capi:
try:
capi.close_ds(self._ptr)
except (AttributeError, TypeError):
pass # Some part might already have been garbage collected
def __str__(self):
return self.name