[pypy-commit] pypy framestate: get RaiseImplicit.rebuild to behave as it should
rlamy
noreply at buildbot.pypy.org
Fri Nov 21 00:57:15 CET 2014
Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: framestate
Changeset: r74621:e0bf1637cf8b
Date: 2014-11-20 22:48 +0000
http://bitbucket.org/pypy/pypy/changeset/e0bf1637cf8b/
Log: get RaiseImplicit.rebuild to behave as it should
diff --git a/rpython/flowspace/flowcontext.py b/rpython/flowspace/flowcontext.py
--- a/rpython/flowspace/flowcontext.py
+++ b/rpython/flowspace/flowcontext.py
@@ -365,6 +365,13 @@
else:
self.last_exception = FSException(data[-2], data[-1])
self.blockstack = state.blocklist[:]
+ self._normalize_raise_signals()
+
+ def _normalize_raise_signals(self):
+ st = self.stack
+ for i in range(len(st)):
+ if isinstance(st[i], RaiseImplicit):
+ st[i] = Raise(st[i].w_exc)
def guessbool(self, w_condition):
if isinstance(w_condition, Constant):
@@ -1242,9 +1249,9 @@
def args(self):
return [self.w_exc.w_type, self.w_exc.w_value]
- @staticmethod
- def rebuild(w_type, w_value):
- return Raise(FSException(w_type, w_value))
+ @classmethod
+ def rebuild(cls, w_type, w_value):
+ return cls(FSException(w_type, w_value))
class RaiseImplicit(Raise):
"""Signals an exception raised implicitly"""
diff --git a/rpython/flowspace/test/test_flowcontext.py b/rpython/flowspace/test/test_flowcontext.py
--- a/rpython/flowspace/test/test_flowcontext.py
+++ b/rpython/flowspace/test/test_flowcontext.py
@@ -7,7 +7,7 @@
@pytest.mark.parametrize('signal', [
Return(Variable()),
Raise(FSException(Variable(), Variable())),
- #RaiseImplicit(FSException(Variable(), Variable())),
+ RaiseImplicit(FSException(Variable(), Variable())),
Break(),
Continue(42),
])
More information about the pypy-commit
mailing list