Author amaury.forgeotdarc
Recipients amaury.forgeotdarc
Date 2008-03-31.15:12:29
SpamBayes Score 0.00581992
Marked as misclassified No
Message-id <>
The following function seems to 8 references each time it is run:

import io, gc
def f():
   class C: pass
   assert isinstance(c, io.StringIO) is False

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:
(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)
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: <>
2008-03-31 15:12:29amaury.forgeotdarclinkissue2521 messages
2008-03-31 15:12:29amaury.forgeotdarccreate