[pypy-svn] r49227 - in pypy/dist/pypy/objspace/flow: . test
arigo at codespeak.net
arigo at codespeak.net
Fri Nov 30 16:04:05 CET 2007
Author: arigo
Date: Fri Nov 30 16:04:03 2007
New Revision: 49227
Modified:
pypy/dist/pypy/objspace/flow/flowcontext.py
pypy/dist/pypy/objspace/flow/test/test_objspace.py
Log:
In the flow objspace: don't freeze into the graph a RuntimeError caught
while building the graph.
Modified: pypy/dist/pypy/objspace/flow/flowcontext.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/flowcontext.py (original)
+++ pypy/dist/pypy/objspace/flow/flowcontext.py Fri Nov 30 16:04:03 2007
@@ -309,6 +309,9 @@
e.w_type is self.space.w_ImportError):
raise ImportError('import statement always raises %s' % (
e,))
+ if e.w_type is self.space.w_RuntimeError:
+ raise RuntimeError('during flow graph construction: %r' % (
+ e.w_value,))
link = self.make_link([e.w_type, e.w_value], self.graph.exceptblock)
self.recorder.crnt_block.closeblock(link)
Modified: pypy/dist/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/dist/pypy/objspace/flow/test/test_objspace.py (original)
+++ pypy/dist/pypy/objspace/flow/test/test_objspace.py Fri Nov 30 16:04:03 2007
@@ -847,6 +847,15 @@
py.test.raises(TypeError, "self.codetest(f)")
+ def test_dont_capture_RuntimeError(self):
+ class Foo:
+ def __hash__(self):
+ return hash(self)
+ foolist = [Foo()]
+ def f():
+ return foolist[0]
+ py.test.raises(RuntimeError, "self.codetest(f)")
+
class TestFlowObjSpaceDelay(Base):
def setup_class(cls):
cls.space = FlowObjSpace()
More information about the Pypy-commit
mailing list