[New-bugs-announce] [issue1438] Calling base class methods is slow due to __instancecheck__ override in abc.py

Guido van Rossum report at bugs.python.org
Tue Nov 13 19:25:43 CET 2007


New submission from Guido van Rossum:

[Guido]
> > I've noticed that abc.py's __instancecheck__ gets called a lot
> > at times when I don't expect it.  Can you research this a bit?

[Amaury]
> In classobject.c, method_call() calls PyObject_IsInstance() on the
> first arg when the method is unbound.
> This happens a lot in io.py, each time the code calls a base class
> method.

[Guido]
I wonder if we should get rid of this isinstance check. It is only used
to be able to issue a pedantic error message. Perhaps we could even get
rid of unbound methods, and just return the underlying function object
instead of creating an unbound method object. This should make things a
bit faster.

----------
messages: 57461
nosy: gvanrossum
severity: normal
status: open
title: Calling base class methods is slow due to __instancecheck__ override in abc.py
versions: Python 3.0

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1438>
__________________________________


More information about the New-bugs-announce mailing list