Commit d40333a2 authored by Stefan Behnel's avatar Stefan Behnel

fix code generated for __dealloc__() and __releasebuffer__() to call...

fix code generated for __dealloc__() and __releasebuffer__() to call WriteUnraisable() on exceptions instead of building a useless traceback
parent 56b6a6d9
...@@ -1293,7 +1293,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1293,7 +1293,6 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("PyErr_Fetch(&etype, &eval, &etb);") code.putln("PyErr_Fetch(&etype, &eval, &etb);")
code.putln("++Py_REFCNT(o);") code.putln("++Py_REFCNT(o);")
code.putln("%s(o);" % entry.func_cname) code.putln("%s(o);" % entry.func_cname)
code.putln("if (PyErr_Occurred()) PyErr_WriteUnraisable(o);")
code.putln("--Py_REFCNT(o);") code.putln("--Py_REFCNT(o);")
code.putln("PyErr_Restore(etype, eval, etb);") code.putln("PyErr_Restore(etype, eval, etb);")
code.putln("}") code.putln("}")
......
...@@ -2788,7 +2788,7 @@ class DefNode(FuncDefNode): ...@@ -2788,7 +2788,7 @@ class DefNode(FuncDefNode):
return self.entry.signature.error_value return self.entry.signature.error_value
def caller_will_check_exceptions(self): def caller_will_check_exceptions(self):
return 1 return self.entry.signature.exception_check
def generate_function_definitions(self, env, code): def generate_function_definitions(self, env, code):
if self.defaults_getter: if self.defaults_getter:
......
...@@ -93,6 +93,7 @@ class Signature(object): ...@@ -93,6 +93,7 @@ class Signature(object):
self.fixed_arg_format = arg_format self.fixed_arg_format = arg_format
self.ret_format = ret_format self.ret_format = ret_format
self.error_value = self.error_value_map.get(ret_format, None) self.error_value = self.error_value_map.get(ret_format, None)
self.exception_check = self.error_value is not None
self.is_staticmethod = False self.is_staticmethod = False
def num_fixed_args(self): def num_fixed_args(self):
...@@ -135,7 +136,9 @@ class Signature(object): ...@@ -135,7 +136,9 @@ class Signature(object):
else: else:
ret_type = self.return_type() ret_type = self.return_type()
exc_value = self.exception_value() 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): def method_flags(self):
if self.ret_format == "O": if self.ret_format == "O":
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment