Author amaury.forgeotdarc
Recipients amaury.forgeotdarc
Date 2008-03-31.15:12:29
SpamBayes Score 0.00581992
Marked as misclassified No
Message-id <1206976350.45.0.982533625998.issue2521@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2008-03-31 15:12:30amaury.forgeotdarcsetspambayes_score: 0.00581992 -> 0.00581992
recipients: + amaury.forgeotdarc
2008-03-31 15:12:30amaury.forgeotdarcsetspambayes_score: 0.00581992 -> 0.00581992
messageid: <1206976350.45.0.982533625998.issue2521@psf.upfronthosting.co.za>
2008-03-31 15:12:29amaury.forgeotdarclinkissue2521 messages
2008-03-31 15:12:29amaury.forgeotdarccreate