From ad2dc7535854394b005fa02f40aaf49679dd8796 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Wed, 9 Sep 2015 07:51:40 -0500 Subject: [PATCH] Don't complain about no result in void methods --- gen_wrap.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/gen_wrap.py b/gen_wrap.py index 5d329c2..e5649ca 100644 --- a/gen_wrap.py +++ b/gen_wrap.py @@ -1455,16 +1455,20 @@ def write_method_wrapper(gen, cls_name, meth): gen("finally:") with Indentation(gen): - gen(r""" - if _result is None: - # This should never happen. - sys.stderr.write("*** islpy was interrupted while collecting " - "a result. " - "System state is inconsistent as a result, aborting.\n") - sys.stderr.flush() - os._exit(-1) - """) + if not (meth.return_base_type == "void" and not meth.return_ptr): + gen(r""" + if _result is None: + # This should never happen. + sys.stderr.write("*** islpy was interrupted while collecting " + "a result. " + "System state is inconsistent as a result, aborting.\n") + sys.stderr.flush() + import os + os._exit(-1) + """) + gen.extend(safety) + gen("pass") gen.extend(check) gen.dedent() -- GitLab