From: Stefan Behnel Date: Fri, 9 Aug 2013 08:47:02 +0000 (+0200) Subject: fix code generated for __dealloc__() and __releasebuffer__() to call WriteUnraisable... X-Git-Tag: 0.20b1~402 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d40333a24b41507455a949fe3d5305c9286c7233;p=platform%2Fupstream%2Fpython-cython.git fix code generated for __dealloc__() and __releasebuffer__() to call WriteUnraisable() on exceptions instead of building a useless traceback --- diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index a5cc35f..a482042 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1293,7 +1293,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): code.putln("PyErr_Fetch(&etype, &eval, &etb);") code.putln("++Py_REFCNT(o);") code.putln("%s(o);" % entry.func_cname) - code.putln("if (PyErr_Occurred()) PyErr_WriteUnraisable(o);") code.putln("--Py_REFCNT(o);") code.putln("PyErr_Restore(etype, eval, etb);") code.putln("}") diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index fc72b89..852d628 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -2788,7 +2788,7 @@ class DefNode(FuncDefNode): return self.entry.signature.error_value def caller_will_check_exceptions(self): - return 1 + return self.entry.signature.exception_check def generate_function_definitions(self, env, code): if self.defaults_getter: diff --git a/Cython/Compiler/TypeSlots.py b/Cython/Compiler/TypeSlots.py index eca0e37..118c704 100644 --- a/Cython/Compiler/TypeSlots.py +++ b/Cython/Compiler/TypeSlots.py @@ -93,6 +93,7 @@ class Signature(object): self.fixed_arg_format = arg_format self.ret_format = ret_format self.error_value = self.error_value_map.get(ret_format, None) + self.exception_check = self.error_value is not None self.is_staticmethod = False def num_fixed_args(self): @@ -135,7 +136,9 @@ class Signature(object): else: ret_type = self.return_type() exc_value = self.exception_value() - return PyrexTypes.CFuncType(ret_type, args, exception_value = exc_value) + return PyrexTypes.CFuncType( + ret_type, args, exception_value=exc_value, + exception_check=self.exception_check) def method_flags(self): if self.ret_format == "O":