[pypy-svn] r57649 - in pypy/branch/typeobject-init/pypy/objspace/flow: . test
arigo at codespeak.net
arigo at codespeak.net
Wed Aug 27 15:47:08 CEST 2008
Author: arigo
Date: Wed Aug 27 15:47:07 2008
New Revision: 57649
Modified:
pypy/branch/typeobject-init/pypy/objspace/flow/flowcontext.py
pypy/branch/typeobject-init/pypy/objspace/flow/objspace.py
pypy/branch/typeobject-init/pypy/objspace/flow/test/test_objspace.py
Log:
Improve the test, showing that r57647 didn't fix anything.
Revert r57647 and try another approach.
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:47:07 2008
@@ -292,10 +292,6 @@
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 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)
self.recorder.crnt_block.closeblock(link)
@@ -383,9 +379,7 @@
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/objspace.py
==============================================================================
--- pypy/branch/typeobject-init/pypy/objspace/flow/objspace.py (original)
+++ pypy/branch/typeobject-init/pypy/objspace/flow/objspace.py Wed Aug 27 15:47:07 2008
@@ -51,8 +51,7 @@
self.w_tuple = Constant(tuple)
self.concrete_mode = 0
for exc in [KeyError, ValueError, IndexError, StopIteration,
- AssertionError, TypeError, AttributeError, ImportError,
- RuntimeError]:
+ AssertionError, TypeError, AttributeError, ImportError]:
clsname = exc.__name__
setattr(self, 'w_'+clsname, Constant(exc))
# the following exceptions are the ones that should not show up
@@ -374,7 +373,7 @@
if outcome is StopIteration:
raise OperationError(self.w_StopIteration, w_exc_value)
elif outcome is RuntimeError:
- raise flowcontext.ImplicitOperationError(self.w_RuntimeError,
+ raise flowcontext.ImplicitOperationError(Constant(RuntimeError),
w_exc_value)
else:
return w_item
@@ -472,6 +471,12 @@
raise KeyboardInterrupt
w_KeyboardInterrupt = property(w_KeyboardInterrupt)
+ def w_RuntimeError(self):
+ # XXX same as w_KeyboardInterrupt()
+ raise RuntimeError("the interpreter raises RuntimeError during "
+ "flow graph construction")
+ w_RuntimeError = property(w_RuntimeError)
+
# the following gives us easy access to declare more for applications:
NOT_REALLY_CONST = {
Constant(sys): {
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:47:07 2008
@@ -342,6 +342,7 @@
for x in lst:
pass
except:
+ lst.append(5)
raise
def test_loop_in_bare_except_bug(self):
More information about the Pypy-commit
mailing list