Message273027
Today we had an internal server error in production. I went to see the sentry logs for the error, and was dismayed: the error was `AttributeError: can't set attribute`, and the faulting line was `setattr(obj, attr, value)` that happens in a for-loop that uses computed properties coming from who knows.
Well, I quickly ruled out that it was because the code was trying to set a value to a read-only property descriptor, the only problem was to find out *which of all these read-only properties* was it trying to set:
Python 3.6.0a3+ (default, Aug 11 2016, 11:45:31)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo:
... @property
... def bar(self): pass
...
>>> setattr(Foo(), 'bar', 42)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: can't set attribute
Could we change this for Python 3.6 so that the message for this could include the name of the property just like `AttributeError: has no attribute 'baz'` does? |
|
Date |
User |
Action |
Args |
2016-08-18 13:57:19 | ztane | set | recipients:
+ ztane |
2016-08-18 13:57:19 | ztane | set | messageid: <1471528639.63.0.0729109170448.issue27794@psf.upfronthosting.co.za> |
2016-08-18 13:57:19 | ztane | link | issue27794 messages |
2016-08-18 13:57:19 | ztane | create | |
|