Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4a5a2bc

Browse files
committed
dynamics(): add a dummy __getattr__ method to the C class so that the
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.
1 parent 1e1de1c commit 4a5a2bc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Lib/test/test_descr.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,11 @@ class SS(D):
870870
# Test dynamic instances
871871
class C(object):
872872
__dynamic__ = 1
873+
# XXX Ideally the following def shouldn't be necessary,
874+
# but it's too much of a performance burden.
875+
# See XXX comment in slot_tp_getattr_hook.
876+
def __getattr__(self, name):
877+
raise AttributeError, name
873878
a = C()
874879
verify(not hasattr(a, "foobar"))
875880
C.foobar = 2

0 commit comments

Comments
 (0)