]> granicus.if.org Git - python/commitdiff
dynamics(): add a dummy __getattr__ method to the C class so that the
authorGuido van Rossum <guido@python.org>
Wed, 3 Oct 2001 13:59:54 +0000 (13:59 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 3 Oct 2001 13:59:54 +0000 (13:59 +0000)
test for modifying __getattr__ works, now that slot_tp_getattr_hook
zaps the slot if there's no hook.  Added an XXX comment with a ref
back to slot_tp_getattr_hook.

Lib/test/test_descr.py

index 36703f52a464d0878bf4b57320b72e30e3cc182e..4ed6853e19f0a34aa0f9ef03394b174e471e95ad 100644 (file)
@@ -870,6 +870,11 @@ def dynamics():
     # Test dynamic instances
     class C(object):
         __dynamic__ = 1
+        # XXX Ideally the following def shouldn't be necessary,
+        # but it's too much of a performance burden.
+        # See XXX comment in slot_tp_getattr_hook.
+        def __getattr__(self, name):
+            raise AttributeError, name
     a = C()
     verify(not hasattr(a, "foobar"))
     C.foobar = 2