[issue24983] Wrong AttributeError propagation

2015-09-02 Thread David Unric
David Unric added the comment: Oops, this was the strict version. The lazy method call version behaves exactly like property getter. So there is probably no implementation bug, but not too well thought out decision design, making debugging AttributeError exceptions in properties difficult and

[issue24983] Wrong AttributeError propagation

2015-09-02 Thread David Unric
David Unric added the comment: This looks a bit inconsistent. See following version with "manual" getter definition: class MyClass(object): def __init__(self, *args, **kwargs): # setting access to getter by attribute # without use of property decorator self.__dict__[

[issue24983] Wrong AttributeError propagation

2015-09-02 Thread eryksun
eryksun added the comment: > exception instance raised in __getattr__ should not lead > to its another call but propagated to outer level In this case the next outer level is your descriptor implementation. You have to ensure it doesn't leak the AttrubuteError. Otherwise the associated __geta

[issue24983] Wrong AttributeError propagation

2015-09-02 Thread David Unric
David Unric added the comment: Thanks for the comprehensive response. I did suspected the 2nd call is caused how it has been described in paragraph 4. And you are probably right. Only think exception instance raised in __getattr__ should not lead to its another call but propagated to outer lev

[issue24983] Wrong AttributeError propagation

2015-09-02 Thread Martin Panter
Martin Panter added the comment: First of all, I think your a.py line 74 corresponds to the top-level print() call. My version of the output: >>> print(my_inst.myproperty) __getattr__ << missing_attribute __getattr__ << myproperty Traceback (most recent call last): File "", line 1, in File

[issue24983] Wrong AttributeError propagation

2015-09-02 Thread David Unric
New submission from David Unric: Hello, it seems python interpreter improperly handles AttributeError exception raised in __getattr__ method, after called by unresolved attribute inside a property. Bellow is a simple Python2 example of a class which defines __getattr__ method and a property,