[issue32683] isinstance is calling ob.__getattribute__ as a fallback instead of object.__class__.__get__

Gabriele N Tornetta report at bugs.python.org
Thu Dec 9 10:02:37 EST 2021


Gabriele N Tornetta <phoenix1987 at gmail.com> added the comment:

I think the issue on display here is that isinstance could cause a side effect, which I dare say it's unexpected (and not documented AFAIK). Are there any reasons why __class__ cannot be retrieved with object.__getattribute__ instead? In fact, considering that __getattribute__ could be overridden, this would be the right thing to do imho, else isinstance would break spectacularly, like in my previous example.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32683>
_______________________________________


More information about the Python-bugs-list mailing list