[pypy-svn] r9492 - pypy/dist/pypy/translator/test
pedronis at codespeak.net
pedronis at codespeak.net
Thu Feb 24 22:38:10 CET 2005
Author: pedronis
Date: Thu Feb 24 22:38:10 2005
New Revision: 9492
Modified:
pypy/dist/pypy/translator/test/snippet.py
pypy/dist/pypy/translator/test/test_annrpython.py
Log:
failing test that shows the problems with annoting exception handling code, when there are many possible exception sources
in the try ... except suite.
Modified: pypy/dist/pypy/translator/test/snippet.py
==============================================================================
--- pypy/dist/pypy/translator/test/snippet.py (original)
+++ pypy/dist/pypy/translator/test/snippet.py Thu Feb 24 22:38:10 2005
@@ -725,6 +725,31 @@
return (e, Exc2())
return (Exc(), Exc2())
+class Exc3(Exception):
+ def m(self):
+ return 1
+
+class Sp:
+ def o(self):
+ raise Exc3
+
+class Mod:
+ def __init__(self, s):
+ self.s = s
+
+ def p(self):
+ s = self.s
+ try:
+ s.o()
+ except Exc3, e:
+ return e.m()
+ return 0
+
+mod = Mod(Sp())
+
+def exc_deduction_our_exc_plus_others():
+ return mod.p()
+
class BltinCode:
def __init__(self, func, framecls):
Modified: pypy/dist/pypy/translator/test/test_annrpython.py
==============================================================================
--- pypy/dist/pypy/translator/test/test_annrpython.py (original)
+++ pypy/dist/pypy/translator/test/test_annrpython.py Thu Feb 24 22:38:10 2005
@@ -483,7 +483,12 @@
assert isinstance(s.items[1], annmodel.SomeInstance)
assert s.items[0].knowntype is snippet.Exc
assert s.items[1].knowntype is snippet.Exc2
-
+
+ def test_exc_deduction_our_exc_plus_others(self):
+ a = RPythonAnnotator()
+ s = a.build_types(snippet.exc_deduction_our_exc_plus_others, [])
+ assert isinstance(s, annmodel.SomeInteger)
+
def test_slice_union(self):
a = RPythonAnnotator()
s = a.build_types(snippet.slice_union, [int])
More information about the Pypy-commit
mailing list