[pypy-commit] pypy ffi-backend: Reimport.

arigo noreply at buildbot.pypy.org
Sat Jun 23 10:00:46 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: ffi-backend
Changeset: r55763:3933f40ae600
Date: 2012-06-23 10:00 +0200
http://bitbucket.org/pypy/pypy/changeset/3933f40ae600/

Log:	Reimport.

diff --git a/pypy/module/_ffi_backend/test/_backend_test_c.py b/pypy/module/_ffi_backend/test/_backend_test_c.py
--- a/pypy/module/_ffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_ffi_backend/test/_backend_test_c.py
@@ -761,15 +761,11 @@
     complete_struct_or_union(BStruct, [('a1', BInt, 1)])
     py.test.raises(NotImplementedError, newp, new_pointer_type(BStruct), [-1])
 
-def test_gc():
-    from gc import collect
+def test_weakref():
+    import weakref
     BInt = new_primitive_type("int")
-    n = cast(BInt, 123)
-    py.test.raises(TypeError, gc, n, 5)
-    destroyed = []
-    m = gc(n, destroyed.append)
-    assert repr(m) == "<cdata 'int' with destructor>"
-    assert destroyed == []
-    del m; collect()
-    assert len(destroyed) == 1
-    assert int(destroyed[0]) == 123
+    BPtr = new_pointer_type(BInt)
+    weakref.ref(BInt)
+    weakref.ref(newp(BPtr, 42))
+    py.test.raises(TypeError, weakref.ref, cast(BPtr, 42))
+    py.test.raises(TypeError, weakref.ref, cast(BInt, 42))


More information about the pypy-commit mailing list