Add is_final to disallow inheritance from Python
- Not currently supported on PyPy
diff --git a/tests/test_class.py b/tests/test_class.py
index ed63ca8..e58fef6 100644
--- a/tests/test_class.py
+++ b/tests/test_class.py
@@ -279,3 +279,21 @@
if hasattr(m, "Aligned"):
p = m.Aligned().ptr()
assert p % 1024 == 0
+
+
+# https://bitbucket.org/pypy/pypy/issues/2742
+@pytest.unsupported_on_pypy
+def test_final():
+ with pytest.raises(TypeError) as exc_info:
+ class PyFinalChild(m.IsFinal):
+ pass
+ assert str(exc_info.value).endswith("is not an acceptable base type")
+
+
+# https://bitbucket.org/pypy/pypy/issues/2742
+@pytest.unsupported_on_pypy
+def test_non_final_final():
+ with pytest.raises(TypeError) as exc_info:
+ class PyNonFinalFinalChild(m.IsNonFinalFinal):
+ pass
+ assert str(exc_info.value).endswith("is not an acceptable base type")