Author: Armin Rigo <[email protected]>
Branch:
Changeset: r491:b95f060800bc
Date: 2012-06-23 10:56 +0200
http://bitbucket.org/cffi/cffi/changeset/b95f060800bc/
Log: Test that we cannot inherit from the types.
diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -779,3 +779,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
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit