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):
code.put_label(code.error_label)
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
code.put_label(code.return_label)
......
# mode: run
cdef class TestErrVal(object):
def __cinit__(self, TestErrVal a):
pass
def test_errval():
"""
>>> test_errval()
Traceback (most recent call last):
...
TypeError: Argument 'a' has incorrect type (expected defnode_err_val.TestErrVal, got int)
"""
TestErrVal(123)
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