[issue24590] Customized attribute access causes infinite loop

2015-07-08 Thread Zorceta
New submission from Zorceta: Code and result: ``` class A: def __init__(self): self.data = {'a': 1, 'b': 2, 'c': 3} def __getattr__(self, name): print('in __getattr__, getting %s' % name) if name in self.data:

[issue24590] Customized attribute access causes infinite loop

2015-07-08 Thread Zorceta
Changes by Zorceta zorc...@gmail.com: -- status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue24590 ___ ___ Python-bugs-list

[issue24590] Customized attribute access causes infinite loop

2015-07-08 Thread Ethan Furman
Ethan Furman added the comment: The error in the example code was in def __init__(self): self.data = ... In order to get around that issue, either `data` needs to be declared at class scope, or special cased in __getattr__. -- nosy: +ethan.furman resolution: - not a bug