[issue27794] setattr a read-only property; the AttributeError should show the attribute that failed

Antti Haapala report at bugs.python.org
Mon Aug 22 14:45:52 EDT 2016


Antti Haapala added the comment:

I've got one idea about how to implement this, but it would require adding a new flag field to PyExc_AttributeError type.

This flag, if set, would tell that the AttributeError in question was raised in C descriptor code or under similar circumstances, and that the attribute name was not known, and thus it is OK for setattr/delattr and attribute lookups to append ": attributename" to the end of the message, then clear the flag; then  all those places that raise AttributeError in __get__, __set__, __del__ would just need to set this flag.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27794>
_______________________________________


More information about the Python-bugs-list mailing list