Commit 1b6695a1 authored by Stefan Behnel's avatar Stefan Behnel

prevent result type casting for StopIteration return value in generators

parent 1a9dad5c
...@@ -5503,8 +5503,8 @@ class ReturnStatNode(StatNode): ...@@ -5503,8 +5503,8 @@ class ReturnStatNode(StatNode):
# return value == raise StopIteration(value), but uncatchable # return value == raise StopIteration(value), but uncatchable
code.putln("%s = NULL;" % Naming.retval_cname) code.putln("%s = NULL;" % Naming.retval_cname)
if not self.value.is_none: if not self.value.is_none:
code.putln("PyErr_SetObject(PyExc_StopIteration, %s);" % code.putln("PyErr_SetObject(PyExc_StopIteration, %s);" % (
self.value.result_as(self.return_type)) self.value.py_result()))
self.value.generate_disposal_code(code) self.value.generate_disposal_code(code)
else: else:
self.value.make_owned_reference(code) self.value.make_owned_reference(code)
......
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