Author: Raffael Tfirst <[email protected]>
Branch: py3.5-async
Changeset: r85747:5d91025f5131
Date: 2016-07-17 23:02 +0200
http://bitbucket.org/pypy/pypy/changeset/5d91025f5131/
Log: Raise runtimewarning if coroutine was never awaited in finalize
diff --git a/pypy/interpreter/generator.py b/pypy/interpreter/generator.py
--- a/pypy/interpreter/generator.py
+++ b/pypy/interpreter/generator.py
@@ -506,6 +506,13 @@
# finally or except blocks are present at the current
# position, then raise a GeneratorExit. Otherwise, there is
# no point.
+ # If coroutine was never awaited on issue a RuntimeWarning.
+ if self.pycode is not None:
+ if self.frame is not None:
+ if self.frame.fget_f_lasti(frame).int_w(frame.space) == -1:
+ raise oefmt(space.w_RuntimeWarning,
+ "coroutine '%s' was never awaited",
+ self.pycode.co_name)
if self.frame is not None:
block = self.frame.lastblock
while block is not None:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit