[pypy-commit] pypy py3.5-async: Fix switched None and iterable object on stack in GET_AWAITABLE (maybe a better fix is possible)

raffael_t pypy.commits at gmail.com
Mon Aug 1 13:16:54 EDT 2016


Author: Raffael Tfirst <raffael.tfirst at gmail.com>
Branch: py3.5-async
Changeset: r85967:131f3d3c8682
Date: 2016-08-01 19:16 +0200
http://bitbucket.org/pypy/pypy/changeset/131f3d3c8682/

Log:	Fix switched None and iterable object on stack in GET_AWAITABLE
	(maybe a better fix is possible)

diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -1441,6 +1441,13 @@
             self.settopvalue(w_iterator)
     
     def GET_AWAITABLE(self, oparg, next_instr):
+        from pypy.objspace.std.noneobject import W_NoneObject
+        if isinstance(self.peekvalue(), W_NoneObject):
+            #switch NoneObject with iterable on stack
+            w_firstnone = self.popvalue()
+            w_i = self.popvalue()
+            self.pushvalue(w_firstnone)
+            self.pushvalue(w_i)
         w_iterable = self.peekvalue()
         w_iter = w_iterable._GetAwaitableIter(self.space)
         self.settopvalue(w_iter)


More information about the pypy-commit mailing list