[pypy-commit] pypy ffi-backend: Port the test; fix.

arigo noreply at buildbot.pypy.org
Sat Jun 23 10:57:55 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: ffi-backend
Changeset: r55766:4d4a1b6f0d45
Date: 2012-06-23 10:57 +0200
http://bitbucket.org/pypy/pypy/changeset/4d4a1b6f0d45/

Log:	Port the test; fix.

diff --git a/pypy/module/_ffi_backend/cdataobj.py b/pypy/module/_ffi_backend/cdataobj.py
--- a/pypy/module/_ffi_backend/cdataobj.py
+++ b/pypy/module/_ffi_backend/cdataobj.py
@@ -183,4 +183,4 @@
     __getitem__ = interp2app(W_CData.getitem),
     __setitem__ = interp2app(W_CData.setitem),
     )
-W_CData.acceptable_as_base_class = False
+W_CData.typedef.acceptable_as_base_class = False
diff --git a/pypy/module/_ffi_backend/ctypeobj.py b/pypy/module/_ffi_backend/ctypeobj.py
--- a/pypy/module/_ffi_backend/ctypeobj.py
+++ b/pypy/module/_ffi_backend/ctypeobj.py
@@ -293,4 +293,4 @@
     '_ffi_backend.CTypeDescr',
     __repr__ = interp2app(W_CType.repr),
     )
-W_CType.acceptable_as_base_class = False
+W_CType.typedef.acceptable_as_base_class = False
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
@@ -769,3 +769,19 @@
     weakref.ref(newp(BPtr, 42))
     py.test.raises(TypeError, weakref.ref, cast(BPtr, 42))
     py.test.raises(TypeError, weakref.ref, cast(BInt, 42))
+
+def test_no_inheritance():
+    BInt = new_primitive_type("int")
+    try:
+        class foo(type(BInt)): pass
+    except TypeError:
+        pass
+    else:
+        raise AssertionError
+    x = cast(BInt, 42)
+    try:
+        class foo(type(x)): pass
+    except TypeError:
+        pass
+    else:
+        raise AssertionError


More information about the pypy-commit mailing list