[pypy-svn] r15959 - in pypy/dist/pypy/rpython/memory: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Aug 11 13:00:25 CEST 2005


Author: cfbolz
Date: Thu Aug 11 13:00:25 2005
New Revision: 15959

Modified:
   pypy/dist/pypy/rpython/memory/gc.py
   pypy/dist/pypy/rpython/memory/test/test_gc.py
Log:
give a more helpful error message as to samuele's suggestion


Modified: pypy/dist/pypy/rpython/memory/gc.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/gc.py	(original)
+++ pypy/dist/pypy/rpython/memory/gc.py	Thu Aug 11 13:00:25 2005
@@ -11,7 +11,7 @@
 
 
 def free_non_gc_object(obj):
-    assert obj.__class__._raw_allocate_
+    assert getattr(obj.__class__, "_raw_allocate_", False), "trying to free regular object"
     obj.__dict__ = {}
     obj.__class__ = FREED_OBJECT
 

Modified: pypy/dist/pypy/rpython/memory/test/test_gc.py
==============================================================================
--- pypy/dist/pypy/rpython/memory/test/test_gc.py	(original)
+++ pypy/dist/pypy/rpython/memory/test/test_gc.py	Thu Aug 11 13:00:25 2005
@@ -11,6 +11,8 @@
             return self.a
         def method2(self):
             return 42
+    class TestClass2(object):
+        pass
     t = TestClass(1)
     assert t.method1() == 1
     assert t.method2() == 42
@@ -18,4 +20,4 @@
     py.test.raises(GCError, "t.method1()")
     py.test.raises(GCError, "t.method2()") 
     py.test.raises(GCError, "t.a")
-    
+    py.test.raises(AssertionError, "free_non_gc_object(TestClass2())")



More information about the Pypy-commit mailing list