[Python-Dev] refleaks on trunk

Neal Norwitz nnorwitz at gmail.com
Tue Apr 1 06:34:10 CEST 2008


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())


More information about the Python-Dev mailing list