Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r94311:4db4624409b4
Date: 2018-04-12 10:25 +0100
http://bitbucket.org/pypy/pypy/changeset/4db4624409b4/

Log:    Issue #2768: rare case involving __del__ methods

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1098,7 +1098,13 @@
         # sub-iterable first before continuing on the next bytecode.
         from pypy.interpreter.generator import Coroutine
         in_generator = self.get_generator()
-        assert in_generator is not None
+        if in_generator is None:
+            # Issue #2768: rare case involving __del__ methods.
+            # XXX This is a workaround, not a proper solution.
+            raise oefmt(self.space.w_RuntimeError,
+                        "PyPy limitation: cannot use 'yield from' or 'await' "
+                        "in a generator/coroutine that has been partially "
+                        "deallocated already, typically seen via __del__")
         w_inputvalue = self.popvalue()    # that's always w_None, actually
         w_gen = self.popvalue()
         #
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to