[pypy-svn] r45070 - in pypy/dist/pypy/translator/c: . test
pedronis at codespeak.net
pedronis at codespeak.net
Sat Jul 14 14:16:16 CEST 2007
Author: pedronis
Date: Sat Jul 14 14:16:15 2007
New Revision: 45070
Modified:
pypy/dist/pypy/translator/c/exceptiontransform.py
pypy/dist/pypy/translator/c/test/test_exceptiontransform.py
Log:
this was broken since forever.
exception transforming was depending on the order with which the graphs were transformed.
preserve across the transformation - stored in the analyzer - whether a graph can raise.
Modified: pypy/dist/pypy/translator/c/exceptiontransform.py
==============================================================================
--- pypy/dist/pypy/translator/c/exceptiontransform.py (original)
+++ pypy/dist/pypy/translator/c/exceptiontransform.py Sat Jul 14 14:16:15 2007
@@ -180,6 +180,7 @@
assert self.exc_data_ptr._same_obj(graph.exceptiontransformed)
return
else:
+ self.raise_analyzer.analyze_direct_call(graph)
graph.exceptiontransformed = self.exc_data_ptr
self.always_exc_clear = always_exc_clear
Modified: pypy/dist/pypy/translator/c/test/test_exceptiontransform.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_exceptiontransform.py (original)
+++ pypy/dist/pypy/translator/c/test/test_exceptiontransform.py Sat Jul 14 14:16:15 2007
@@ -175,6 +175,17 @@
etrafo2 = exceptiontransform.ExceptionTransformer(t)
py.test.raises(AssertionError, etrafo2.create_exception_handling, g)
+def test_preserve_can_raise():
+ def f(x):
+ raise ValueError
+ t = TranslationContext()
+ t.buildannotator().build_types(f, [int])
+ t.buildrtyper().specialize()
+ g = graphof(t, f)
+ etrafo = exceptiontransform.ExceptionTransformer(t)
+ etrafo.create_exception_handling(g)
+ assert etrafo.raise_analyzer.analyze_direct_call(g)
+
def test_inserting_zeroing_op():
from pypy.rpython.lltypesystem import lltype
S = lltype.GcStruct("S", ('x', lltype.Signed))
More information about the Pypy-commit
mailing list