[pypy-commit] pypy translation-cleanup: Remove HostCode.magic and simplify WITH_CLEANUP
rlamy
noreply at buildbot.pypy.org
Fri Oct 5 19:02:19 CEST 2012
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: translation-cleanup
Changeset: r57797:618bf2b10fd1
Date: 2012-10-05 01:49 +0100
http://bitbucket.org/pypy/pypy/changeset/618bf2b10fd1/
Log: Remove HostCode.magic and simplify WITH_CLEANUP
diff --git a/pypy/objspace/flow/bytecode.py b/pypy/objspace/flow/bytecode.py
--- a/pypy/objspace/flow/bytecode.py
+++ b/pypy/objspace/flow/bytecode.py
@@ -38,7 +38,6 @@
self.co_name = name
self.co_firstlineno = firstlineno
self.co_lnotab = lnotab
- self.magic = magic
self.signature = cpython_code_signature(self)
self._initialize()
diff --git a/pypy/objspace/flow/flowcontext.py b/pypy/objspace/flow/flowcontext.py
--- a/pypy/objspace/flow/flowcontext.py
+++ b/pypy/objspace/flow/flowcontext.py
@@ -1,4 +1,6 @@
+import sys
import collections
+
from pypy.tool.error import source_lines
from pypy.interpreter import pyframe
from pypy.interpreter.nestedscope import Cell
@@ -636,19 +638,13 @@
# Note: RPython context managers receive None in lieu of tracebacks
# and cannot suppress the exception.
# This opcode changed a lot between CPython versions
- if (self.pycode.magic >= 0xa0df2ef
- # Implementation since 2.7a0: 62191 (introduce SETUP_WITH)
- or self.pycode.magic >= 0xa0df2d1):
- # implementation since 2.6a1: 62161 (WITH_CLEANUP optimization)
+ if sys.version_info >= (2, 6):
w_unroller = self.popvalue()
w_exitfunc = self.popvalue()
self.pushvalue(w_unroller)
- elif self.pycode.magic >= 0xa0df28c:
- # Implementation since 2.5a0: 62092 (changed WITH_CLEANUP opcode)
+ else:
w_exitfunc = self.popvalue()
w_unroller = self.peekvalue(0)
- else:
- raise NotImplementedError("WITH_CLEANUP for CPython <= 2.4")
unroller = self.space.unwrap(w_unroller)
w_None = self.space.w_None
More information about the pypy-commit
mailing list