[pypy-svn] r73179 - pypy/trunk/pypy/rlib/test

benjamin at codespeak.net benjamin at codespeak.net
Tue Mar 30 17:48:32 CEST 2010


Author: benjamin
Date: Tue Mar 30 17:48:30 2010
New Revision: 73179

Modified:
   pypy/trunk/pypy/rlib/test/test_rstackovf.py
Log:
add test about cpython raises AttributeError

Modified: pypy/trunk/pypy/rlib/test/test_rstackovf.py
==============================================================================
--- pypy/trunk/pypy/rlib/test/test_rstackovf.py	(original)
+++ pypy/trunk/pypy/rlib/test/test_rstackovf.py	Tue Mar 30 17:48:30 2010
@@ -1,4 +1,5 @@
 import sys
+import py
 from pypy.rlib import rstackovf
 
 def recurse(n):
@@ -18,6 +19,21 @@
 def test_direct():
     assert f(sys.maxint) == 1
 
+class RecurseGetAttr(object):
+
+    def __getattr__(self, attr):
+        return getattr(self, attr)
+
+def test_raises_AttributeError():
+    rga = RecurseGetAttr()
+    try:
+        rga.y
+    except AttributeError:
+        pass
+    else:
+        py.test.skip("interpreter is not badly behaved")
+    py.test.raises(rstackovf.StackOverflow, getattr, rga, "y")
+
 def test_llinterp():
     from pypy.rpython.test.test_llinterp import interpret
     res = interpret(f, [sys.maxint])



More information about the Pypy-commit mailing list