Loaded real destructor functions before garbage time

This is an alternative patch to the unsuccessful b43b27bcd.
This commit is contained in:
Claude Paroz 2015-06-25 23:46:00 +02:00
parent ad82d0003b
commit 60879a2193
1 changed files with 5 additions and 0 deletions

View File

@ -125,6 +125,11 @@ class IOBase(GEOSBase):
def __init__(self):
# Getting the pointer with the constructor.
self.ptr = self._constructor()
# Loading the real destructor function at this point as doing it in
# __del__ is too late (import error).
self._destructor.func = self._destructor.get_func(
*self._destructor.args, **self._destructor.kwargs
)
def __del__(self):
# Cleaning up with the appropriate destructor.