[pypy-svn] r26465 - in pypy/dist/pypy/module/_weakref: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Thu Apr 27 22:45:52 CEST 2006


Author: cfbolz
Date: Thu Apr 27 22:45:51 2006
New Revision: 26465

Modified:
   pypy/dist/pypy/module/_weakref/interp__weakref.py
   pypy/dist/pypy/module/_weakref/test/test_weakref.py
Log:
_really_ prevent subclassing + tests


Modified: pypy/dist/pypy/module/_weakref/interp__weakref.py
==============================================================================
--- pypy/dist/pypy/module/_weakref/interp__weakref.py	(original)
+++ pypy/dist/pypy/module/_weakref/interp__weakref.py	Thu Apr 27 22:45:51 2006
@@ -208,7 +208,7 @@
     __new__ = interp2app(descr__new__proxy),
     __hash__ = interp2app(W_Proxy.descr__hash__, unwrap_spec=['self', ObjSpace]),
     **proxy_typedef_dict)
-W_Proxy.typedef.accepable_as_base_class = False
+W_Proxy.typedef.acceptable_as_base_class = False
 
 W_CallableProxy.typedef = TypeDef("weakcallableproxy",
     __new__ = interp2app(descr__new__callableproxy),
@@ -216,5 +216,5 @@
     __call__ = interp2app(W_CallableProxy.descr__call__,
                           unwrap_spec=['self', ObjSpace, Arguments]), 
     **callable_proxy_typedef_dict)
-W_CallableProxy.typedef.accepable_as_base_class = False
+W_CallableProxy.typedef.acceptable_as_base_class = False
 

Modified: pypy/dist/pypy/module/_weakref/test/test_weakref.py
==============================================================================
--- pypy/dist/pypy/module/_weakref/test/test_weakref.py	(original)
+++ pypy/dist/pypy/module/_weakref/test/test_weakref.py	Thu Apr 27 22:45:51 2006
@@ -166,3 +166,11 @@
         a = A()
         p = _weakref.proxy(a)
         raises(TypeError, hash, p)
+
+    def test_subclassing_not_allowed(self):
+        import _weakref
+        def tryit():
+            class A(_weakref.ProxyType):
+                pass
+            return A
+        raises(TypeError, tryit)



More information about the Pypy-commit mailing list