Gabriele N Tornetta <phoenix1...@gmail.com> added the comment:

> Python is very much a language about responsibility.  If Django is overriding 
> `__getattribute__` then it is their responsibility to ensure that everything 
> still works properly.

Perhaps I didn't stress observability enough. A tool like a tracer or a 
profiler, in the ideal world, is not supposed to perturb the tracee in any way. 
The current implementation of isinstance, when used by an observability tool, 
may cause side effects as well as overheads, so it is not safe to use in such 
tools. Working around it may solve the side-effects issue, but leaves the 
problem of overheads. Changing the way isinstance works internally might prove 
beneficial for such tools.

En passant,  I think it should be noted that the built-in "type" doesn't suffer 
from the same problem, i.e.

~~~
class Side(object):
    def __getattribute__(self, name):
        ValueError(name)


type(Side())
~~~

works as expected.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32683>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to