Issue2521
Created on 2008-03-31 15:12 by amaury.forgeotdarc, last changed 2008-05-07 11:35 by pitrou.
| msg64784 (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) |
Date: 2008-03-31 15:12 |
|
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)
|
|
| Date |
User |
Action |
Args |
| 2008-05-07 11:35:15 | pitrou | set | nosy:
+ pitrou |
| 2008-03-31 15:12:29 | amaury.forgeotdarc | create | |
|