Message408128
I'd be inclined to see this as a bug in your code, if you are causing side-effects from `__getattribute__`. If you don't want attribute access to cause side-effects, then don't put code in `__getattribute__` that causes side-effects :-)
isinstance has to check the object's `__class__`, if it has one. To do that it has to look at obj.__class__, which your class intercepts using `__getattribute__` and causes a side-effect.
Overloading `__getattribute__` is perilous, because it intercepts *all* instance attribute lookups. In my opinion, one should (almost?) never overload the `__getattribute__` method, it is safer to overload `__getattr__`.
In any case, I don't think there is anything to fix here. Dan has not responded since his initial bug report nearly four years ago, so I'm inclined to close this as "Not A Bug". Unless somebody gives a more convincing reason why the current behaviour is wrong, I think we should close it. |
|
Date |
User |
Action |
Args |
2021-12-09 14:34:26 | steven.daprano | set | recipients:
+ steven.daprano, r.david.murray, bup, Gabriele Tornetta |
2021-12-09 14:34:26 | steven.daprano | set | messageid: <1639060466.06.0.0890010719351.issue32683@roundup.psfhosted.org> |
2021-12-09 14:34:26 | steven.daprano | link | issue32683 messages |
2021-12-09 14:34:25 | steven.daprano | create | |
|