Commit cc65e45c authored by Stefan Behnel's avatar Stefan Behnel

fix refnanny counting for StopIteration value in yield-from

parent 77eb0f6f
...@@ -7884,9 +7884,11 @@ class YieldFromExprNode(YieldExprNode): ...@@ -7884,9 +7884,11 @@ class YieldFromExprNode(YieldExprNode):
# either error or sub-generator has normally terminated: return value => node result # either error or sub-generator has normally terminated: return value => node result
if self.result_is_used: if self.result_is_used:
# YieldExprNode has allocated the result temp for us # YieldExprNode has allocated the result temp for us
code.putln("%s = NULL;" % self.result())
code.putln("if (unlikely(__Pyx_PyGen_FetchStopIterationValue(&%s) < 0)) %s" % ( code.putln("if (unlikely(__Pyx_PyGen_FetchStopIterationValue(&%s) < 0)) %s" % (
self.result(), self.result(),
code.error_goto(self.pos))) code.error_goto(self.pos)))
code.put_gotref(self.result())
else: else:
code.putln("PyObject* exc_type = PyErr_Occurred();") code.putln("PyObject* exc_type = PyErr_Occurred();")
code.putln("if (exc_type) {") code.putln("if (exc_type) {")
......
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