[pypy-svn] r35195 - pypy/branch/jit-real-world/pypy/interpreter
arigo at codespeak.net
arigo at codespeak.net
Fri Dec 1 12:43:03 CET 2006
Author: arigo
Date: Fri Dec 1 12:43:01 2006
New Revision: 35195
Modified:
pypy/branch/jit-real-world/pypy/interpreter/pyopcode.py
Log:
Fix a typo, move a bit of code out of dispatch_bytecode().
Modified: pypy/branch/jit-real-world/pypy/interpreter/pyopcode.py
==============================================================================
--- pypy/branch/jit-real-world/pypy/interpreter/pyopcode.py (original)
+++ pypy/branch/jit-real-world/pypy/interpreter/pyopcode.py Fri Dec 1 12:43:01 2006
@@ -62,7 +62,7 @@
except MemoryError:
next_instr = self.handle_asynchronous_error(ec,
self.space.w_MemoryError)
- except RuntimeError:
+ except RuntimeError, e:
if we_are_translated():
# stack overflows should be the only kind of RuntimeErrors
# in translated PyPy
@@ -131,7 +131,6 @@
w_returnvalue = self.valuestack.pop()
block = self.unrollstack(SReturnValue.kind)
if block is None:
- self.frame_finished_execution = True # for generators
return w_returnvalue
else:
unroller = SReturnValue(w_returnvalue)
@@ -143,20 +142,11 @@
return w_yieldvalue
if opcode == opcodedesc.END_FINALLY.index:
- # unlike CPython, when we reach this opcode the value stack has
- # always been set up as follows (topmost first):
- # [exception type or None]
- # [exception value or None]
- # [wrapped stack unroller ]
- self.valuestack.pop() # ignore the exception type
- self.valuestack.pop() # ignore the exception value
- w_unroller = self.valuestack.pop()
- unroller = self.space.interpclass_w(w_unroller)
+ unroller = self.end_finally()
if isinstance(unroller, SuspendedUnroller):
# go on unrolling the stack
block = self.unrollstack(unroller.kind)
if block is None:
- self.frame_finished_execution = True # for generators
return unroller.nomoreblocks()
else:
next_instr = block.handle(self, unroller)
@@ -194,6 +184,8 @@
block = self.blockstack.pop()
if (block.handling_mask & unroller_kind) != 0:
return block
+ block.cleanupstack(self)
+ self.frame_finished_execution = True # for generators
return None
def unrollstack_and_jump(self, unroller):
@@ -504,6 +496,18 @@
block = f.blockstack.pop()
block.cleanup(f) # the block knows how to clean up the value stack
+ def end_finally(f):
+ # unlike CPython, when we reach this opcode the value stack has
+ # always been set up as follows (topmost first):
+ # [exception type or None]
+ # [exception value or None]
+ # [wrapped stack unroller ]
+ f.valuestack.pop() # ignore the exception type
+ f.valuestack.pop() # ignore the exception value
+ w_unroller = f.valuestack.pop()
+ unroller = f.space.interpclass_w(w_unroller)
+ return unroller
+
def BUILD_CLASS(f, *ignored):
w_methodsdict = f.valuestack.pop()
w_bases = f.valuestack.pop()
More information about the pypy-svn
mailing list