[pypy-svn] r57647 - in pypy/branch/typeobject-init/pypy/objspace/flow: . test
arigo at codespeak.net
arigo at codespeak.net
Wed Aug 27 15:19:14 CEST 2008
Author: arigo
Date: Wed Aug 27 15:19:13 2008
New Revision: 57647
Modified:
pypy/branch/typeobject-init/pypy/objspace/flow/flowcontext.py
pypy/branch/typeobject-init/pypy/objspace/flow/test/test_objspace.py
Log:
Test and fix in the flow object space (duh).
Modified: pypy/branch/typeobject-init/pypy/objspace/flow/flowcontext.py
==============================================================================
--- pypy/branch/typeobject-init/pypy/objspace/flow/flowcontext.py (original)
+++ pypy/branch/typeobject-init/pypy/objspace/flow/flowcontext.py Wed Aug 27 15:19:13 2008
@@ -292,7 +292,8 @@
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:
+ if (e.w_type is self.space.w_RuntimeError and
+ not hasattr(e, '_comes_from_implicit')):
raise RuntimeError('during flow graph construction: %r' % (
e.w_value,))
link = self.make_link([e.w_type, e.w_value], self.graph.exceptblock)
@@ -382,7 +383,9 @@
operr = ExecutionContext.sys_exc_info(self)
if isinstance(operr, ImplicitOperationError):
# re-raising an implicit operation makes it an explicit one
+ src = operr
operr = OperationError(operr.w_type, operr.w_value)
+ operr._comes_from_implicit = src
return operr
# hack for unrolling iterables, don't use this
Modified: pypy/branch/typeobject-init/pypy/objspace/flow/test/test_objspace.py
==============================================================================
--- pypy/branch/typeobject-init/pypy/objspace/flow/test/test_objspace.py (original)
+++ pypy/branch/typeobject-init/pypy/objspace/flow/test/test_objspace.py Wed Aug 27 15:19:13 2008
@@ -337,6 +337,18 @@
traverse(find_exceptions, x)
assert found == {ValueError: True, ZeroDivisionError: True, OverflowError: True}
+ def loop_in_bare_except_bug(lst):
+ try:
+ for x in lst:
+ pass
+ except:
+ raise
+
+ def test_loop_in_bare_except_bug(self):
+ x = self.codetest(self.loop_in_bare_except_bug)
+ simplify_graph(x)
+ self.show(x)
+
#__________________________________________________________
def freevar(self, x):
def adder(y):
More information about the Pypy-commit
mailing list