Commit bef95224 authored by Vitja Makarov's avatar Vitja Makarov

DefNodeWrapper: set __pyx_r to error_value() on error

parent 98487311
......@@ -3365,6 +3365,9 @@ class DefNodeWrapper(FuncDefNode):
for cname, type in code.funcstate.all_managed_temps():
code.put_xdecref(cname, type)
err_val = self.error_value()
if err_val is not None:
code.putln("%s = %s;" % (Naming.retval_cname, err_val))
# ----- Non-error return cleanup
# mode: run
cdef class TestErrVal(object):
def __cinit__(self, TestErrVal a):
def test_errval():
>>> test_errval()
Traceback (most recent call last):
TypeError: Argument 'a' has incorrect type (expected defnode_err_val.TestErrVal, got int)
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