mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
1e1de1cf35
commit
4a5a2bc2b6
|
@ -870,6 +870,11 @@ def dynamics():
|
||||||
# Test dynamic instances
|
# Test dynamic instances
|
||||||
class C(object):
|
class C(object):
|
||||||
__dynamic__ = 1
|
__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()
|
a = C()
|
||||||
verify(not hasattr(a, "foobar"))
|
verify(not hasattr(a, "foobar"))
|
||||||
C.foobar = 2
|
C.foobar = 2
|
||||||
|
|
Loading…
Reference in New Issue