[pypy-commit] pypy py3k: bah, we need to support both py3k and py2 bytecodes, for the flow objspace. Add a flag to the space, and check whether or not we need to support POP_EXCEPT
antocuni
noreply at buildbot.pypy.org
Wed Feb 15 12:34:21 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r52504:c0a619c7c1db
Date: 2012-02-15 12:31 +0100
http://bitbucket.org/pypy/pypy/changeset/c0a619c7c1db/
Log: bah, we need to support both py3k and py2 bytecodes, for the flow
objspace. Add a flag to the space, and check whether or not we need
to support POP_EXCEPT
diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -272,6 +272,7 @@
http://pypy.readthedocs.org/en/latest/objspace.html"""
full_exceptions = True # full support for exceptions (normalization & more)
+ py3k = True # are we interpreting py3k bytecode?
def __init__(self, config=None):
"NOT_RPYTHON: Basic initialization of objects."
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -529,6 +529,7 @@
self.setdictscope(w_locals)
def POP_EXCEPT(self, oparg, next_instr):
+ assert self.space.py3k
# on CPython, POP_EXCEPT also pops the block. Here, the block is
# automatically popped by unrollstack()
self.last_exception = self.popvalue()
@@ -1275,7 +1276,9 @@
# the stack setup is slightly different than in CPython:
# instead of the traceback, we store the unroller object,
# wrapped.
- frame.pushvalue(frame.last_exception) # this is popped by POP_EXCEPT
+ if frame.space.py3k:
+ # this is popped by POP_EXCEPT, which is present only in py3k
+ frame.pushvalue(frame.last_exception)
frame.pushvalue(frame.space.wrap(unroller))
frame.pushvalue(operationerr.get_w_value(frame.space))
frame.pushvalue(operationerr.w_type)
diff --git a/pypy/objspace/flow/objspace.py b/pypy/objspace/flow/objspace.py
--- a/pypy/objspace/flow/objspace.py
+++ b/pypy/objspace/flow/objspace.py
@@ -47,6 +47,7 @@
"""
full_exceptions = False
+ py3k = False # the RPython bytecode is still python2
do_imports_immediately = True
FrameClass = flowcontext.FlowSpaceFrame
More information about the pypy-commit
mailing list