This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author steven.daprano
Recipients Gabriele Tornetta, bup, r.david.murray, steven.daprano
Date 2021-12-09.14:34:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1639060466.06.0.0890010719351.issue32683@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-12-09 14:34:26steven.dapranosetrecipients: + steven.daprano, r.david.murray, bup, Gabriele Tornetta
2021-12-09 14:34:26steven.dapranosetmessageid: <1639060466.06.0.0890010719351.issue32683@roundup.psfhosted.org>
2021-12-09 14:34:26steven.dapranolinkissue32683 messages
2021-12-09 14:34:25steven.dapranocreate