From 3ebb7c16098f5ff0e6775b52e81b3f6cdecde17c Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 6 Jul 2015 01:57:49 -0500
Subject: [PATCH] Minor keyboard-interrupt safety fixes

---
 gen_wrap.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gen_wrap.py b/gen_wrap.py
index 2a99d46..4c02c19 100644
--- a/gen_wrap.py
+++ b/gen_wrap.py
@@ -1429,9 +1429,9 @@ def write_method_wrapper(gen, cls_name, meth):
 
     gen("try:")
     with Indentation(gen):
-        gen("_result = None")
         gen("with DelayedKeyboardInterrupt():")
         with Indentation(gen):
+            gen("_result = None")
             gen(
                 "_result = lib.{c_name}({args})"
                 .format(c_name=meth.c_name, args=", ".join(passed_args)))
@@ -1444,7 +1444,7 @@ def write_method_wrapper(gen, cls_name, meth):
                 print("*** islpy was interrupted while collecting a result. "
                     "System state is inconsistent as a result, aborting.",
                     file=sys.stderr)
-                sys._exit(-1)
+                os._exit(-1)
             """)
         gen.extend(safety)
 
-- 
GitLab