On Tue, Apr 1, 2008 at 6:34 AM, Neal Norwitz <[EMAIL PROTECTED]> wrote:
> test_io is the only leaky test on trunk that I know of.  I narrowed
>  down the leaks to the code below.
>
>  It's possible there are other leaks in test_io.
>
>  n
>  --
>  import sys, gc
>  import _fileio, io
>
>  class FileIO(_fileio._FileIO, io.RawIOBase):
>     def close(self):
>         io.RawIOBase.close(self)
>
>  def main():
>   class MyFileIO(FileIO): pass
>   f = MyFileIO('tt-test', "w")
>   f.close()
>
>  for i in range(10):
>   main()
>   print(gc.collect())
>   print(sys.gettotalrefcount())

The problem is that the MyFileIO class is registered in
io.RawIOBase._abc_cache, and never freed.
This is a problem with ABCs: _abc_cache should be changed to a
WeakSet, like python3.0 did.

I filed http://bugs.python.org/issue2521 about this problem.

-- 
Amaury Forgeot d'Arc
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to