From 60879a2193fe79b3853c60782fc4f1fdfdd55d63 Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 25 Jun 2015 23:46:00 +0200 Subject: [PATCH] Loaded real destructor functions before garbage time This is an alternative patch to the unsuccessful b43b27bcd. --- django/contrib/gis/geos/prototypes/io.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/django/contrib/gis/geos/prototypes/io.py b/django/contrib/gis/geos/prototypes/io.py index de049e460f0..656ff922b49 100644 --- a/django/contrib/gis/geos/prototypes/io.py +++ b/django/contrib/gis/geos/prototypes/io.py @@ -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.