New submission from Amaury Forgeot d'Arc <[EMAIL PROTECTED]>: The following function seems to 8 references each time it is run:
import io, gc def f(): class C: pass c=C() assert isinstance(c, io.StringIO) is False gc.collect();gc.collect();gc.collect() This is because io.StringIO._abc_negative_cache contains a strong reference to each "class C", as soon as isinstance() is called. These are never released. Python3.0 does use WeakSet for these caches, and does not leak. This is the (deep) reason why test_io.IOTest.test_destructor() leaks in the following report: http://mail.python.org/pipermail/python-checkins/2008-March/067918.html (The test derives from io.FileIO, and it is the call to the base class' method which calls isinstance() and put the class in the cache) ---------- components: Interpreter Core keywords: 26backport messages: 64784 nosy: amaury.forgeotdarc severity: normal status: open title: ABC caches should use weak refs versions: Python 2.6 __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2521> __________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com