[pypy-commit] pypy py3.5-async: Change stack effect of POP_EXCEPT from -1 to -2, to compensate the depth in 'async for', because all except-finally depths are different in cpython. shorten the 'async for' test case by 5 seconds
raffael_t
pypy.commits at gmail.com
Thu Aug 18 09:54:41 EDT 2016
Author: Raffael Tfirst <raffael.tfirst at gmail.com>
Branch: py3.5-async
Changeset: r86273:e51e6872dbf1
Date: 2016-08-18 15:54 +0200
http://bitbucket.org/pypy/pypy/changeset/e51e6872dbf1/
Log: Change stack effect of POP_EXCEPT from -1 to -2, to compensate the
depth in 'async for', because all except-finally depths are
different in cpython. shorten the 'async for' test case by 5 seconds
diff --git a/pypy/interpreter/astcompiler/assemble.py b/pypy/interpreter/astcompiler/assemble.py
--- a/pypy/interpreter/astcompiler/assemble.py
+++ b/pypy/interpreter/astcompiler/assemble.py
@@ -606,7 +606,7 @@
ops.WITH_CLEANUP_FINISH: -1, # XXX Sometimes more
ops.LOAD_BUILD_CLASS: 1,
ops.POP_BLOCK: 0,
- ops.POP_EXCEPT: -1,
+ ops.POP_EXCEPT: -2,
ops.END_FINALLY: -4, # assume always 4: we pretend that SETUP_FINALLY
# pushes 4. In truth, it would only push 1 and
# the corresponding END_FINALLY only pops 1.
diff --git a/pypy/interpreter/astcompiler/codegen.py b/pypy/interpreter/astcompiler/codegen.py
--- a/pypy/interpreter/astcompiler/codegen.py
+++ b/pypy/interpreter/astcompiler/codegen.py
@@ -637,13 +637,17 @@
self.use_next_block(b_try_cleanup)
self.emit_op(ops.END_FINALLY)
+
self.use_next_block(b_after_try)
self.visit_sequence(fr.body)
self.emit_jump(ops.JUMP_ABSOLUTE, b_try, True)
+
self.emit_op(ops.POP_BLOCK) # for SETUP_LOOP
self.pop_frame_block(F_BLOCK_LOOP, b_try)
+
self.use_next_block(b_after_loop)
self.emit_jump(ops.JUMP_ABSOLUTE, b_end, True)
+
self.use_next_block(b_after_loop_else)
self.visit_sequence(fr.orelse)
diff --git a/pypy/module/_asyncio/test/test_asyncio.py b/pypy/module/_asyncio/test/test_asyncio.py
--- a/pypy/module/_asyncio/test/test_asyncio.py
+++ b/pypy/module/_asyncio/test/test_asyncio.py
@@ -33,14 +33,14 @@
class AsyncIter:
def __init__(self):
- self._data = list(range(10))
+ self._data = list(range(5))
self._index = 0
async def __aiter__(self):
return self
async def __anext__(self):
- while self._index < 10:
+ while self._index < 5:
await asyncio.sleep(1)
self._index += 1
return self._data[self._index-1]
More information about the pypy-commit
mailing list