[pypy-svn] r23312 - pypy/branch/genc-gc-refactoring/test

cfbolz at codespeak.net cfbolz at codespeak.net
Tue Feb 14 03:40:44 CET 2006


Author: cfbolz
Date: Tue Feb 14 03:40:39 2006
New Revision: 23312

Modified:
   pypy/branch/genc-gc-refactoring/test/test_newgc.py
Log:
(arigo, cfbolz)
two tests that show the current wrong behaviour of __del__. One raises an
exception, the other produces a segfault.


Modified: pypy/branch/genc-gc-refactoring/test/test_newgc.py
==============================================================================
--- pypy/branch/genc-gc-refactoring/test/test_newgc.py	(original)
+++ pypy/branch/genc-gc-refactoring/test/test_newgc.py	Tue Feb 14 03:40:39 2006
@@ -128,3 +128,38 @@
     assert fn(1) == 4
     assert fn(0) == 5
 
+#________________________________________________________________
+# currently crashing tests
+
+
+def DONTtest_del_catches():
+    import os
+    def g():
+        pass
+    class A(object):
+        def __del__(self):
+            try:
+                g()
+            except:
+                os.write(1, "hallo")
+    def f1(i):
+        if i:
+            raise TypeError
+    def f(i):
+        a = A()
+        f1(i)
+        a.b = 1
+        return a.b
+    fn = compile_func(f, [int])
+    assert fn(0) == 1
+    assert py.test.raises(TypeError, fn, 1)
+
+def DONTtest_del_raises():
+    class B(object):
+        def __del__(self):
+            raise TypeError
+    def func():
+        b = B()
+    fn = compile_func(func, [])
+    # does not crash
+    fn()



More information about the Pypy-commit mailing list