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.

classification
Title: Calling base class methods is slow due to __instancecheck__ override in abc.py
Type: Stage:
Components: Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: christian.heimes, gvanrossum
Priority: normal Keywords:

Created on 2007-11-13 18:25 by gvanrossum, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (3)
msg57461 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2007-11-13 18:25
[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.
msg57675 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-11-20 00:49
I think the problem should be addressed after alpha 2.
msg58044 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2007-12-01 13:27
Unbound methods are gone and so is the isinstance check in method_call().
History
Date User Action Args
2022-04-11 14:56:28adminsetgithub: 45779
2008-01-06 22:29:45adminsetkeywords: - py3k
versions: Python 3.0
2007-12-01 13:27:38christian.heimessetstatus: open -> closed
resolution: fixed
messages: + msg58044
2007-11-20 00:49:18christian.heimessetpriority: normal
keywords: + py3k
messages: + msg57675
nosy: + christian.heimes
2007-11-13 18:26:20gvanrossumsetassignee: gvanrossum
2007-11-13 18:25:43gvanrossumcreate