[pypy-svn] r45012 - in pypy/dist/pypy/rpython/lltypesystem: . test

arigo at codespeak.net arigo at codespeak.net
Fri Jul 13 13:42:27 CEST 2007


Author: arigo
Date: Fri Jul 13 13:42:26 2007
New Revision: 45012

Modified:
   pypy/dist/pypy/rpython/lltypesystem/lltype.py
   pypy/dist/pypy/rpython/lltypesystem/test/test_lltype.py
Log:
(lac, arigo)
Set the _dead attribute correctly when lltype.free() is called.


Modified: pypy/dist/pypy/rpython/lltypesystem/lltype.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/lltype.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/lltype.py	Fri Jul 13 13:42:26 2007
@@ -1664,6 +1664,7 @@
     T = typeOf(p)
     if not isinstance(T, Ptr) or p._togckind() != 'raw':
         raise TypeError, "free(): only for pointers to non-gc containers"
+    p._obj._free()
 
 def functionptr(TYPE, name, **attrs):
     if not isinstance(TYPE, FuncType):

Modified: pypy/dist/pypy/rpython/lltypesystem/test/test_lltype.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/test/test_lltype.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/test/test_lltype.py	Fri Jul 13 13:42:26 2007
@@ -427,7 +427,9 @@
     p = malloc(S, flavor="raw")
     assert typeOf(p).TO == S
     assert not isweak(p, S)
+    p.x = 2
     free(p, flavor="raw")
+    py.test.raises(RuntimeError, "p.x")
     T = GcStruct('T', ('y', Signed))
     p = malloc(T, flavor="gc")
     assert typeOf(p).TO == T


More information about the pypy-svn mailing list