From e02bef63d6f8992f01c32406d0bf2e30ead5db98 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Thu, 16 Nov 2017 12:57:58 -0600 Subject: [PATCH] From-string construction: prevent __del__ crash if construction fails (Fixes #2 on Gitlab) --- islpy/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/islpy/__init__.py b/islpy/__init__.py index d89a6e1..1683221 100644 --- a/islpy/__init__.py +++ b/islpy/__init__.py @@ -183,6 +183,11 @@ def _add_functionality(): if context is None: context = DEFAULT_CONTEXT + # Turns out __del__ is called even if the constructor fails with an + # exception. This is creates a semi-valid state that's just good + # enough to get us past the __del__ method. + self.data = None + new_me = self.read_from_str(context, s) self._setup(new_me._release()) -- GitLab