[issue1597] running test_ctypes 25 times in a row causes it to fail

Guido van Rossum report at bugs.python.org
Wed Dec 12 21:26:14 CET 2007


Guido van Rossum added the comment:

> The minimal code reporting the -33/+33 leaks that I found is simply this:
>
>    os.popen('ls').read()
>
> Is there a problem in "os.popen(...)", or do I something wrong here?

Try this instead:

 p = os.popen('ls')
 try:
   x = p.read()
 finally:
   p.close()

IOW close the pipe explicitly. That should make the code execute in a
more reproducible fashion. I've fixed this in ctypes/util.py now:
r59477.

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1597>
__________________________________


More information about the Python-bugs-list mailing list