This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients gvanrossum, theller
Date 2007-12-12.20:26:14
SpamBayes Score 0.0023806742
Marked as misclassified No
Message-id <ca471dc20712121226u60a42caj935f4bc159238651@mail.gmail.com>
In-reply-to <47604079.4010607@ctypes.org>
Content
> 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.
History
Date User Action Args
2007-12-12 20:26:15gvanrossumsetspambayes_score: 0.00238067 -> 0.0023806742
recipients: + gvanrossum, theller
2007-12-12 20:26:14gvanrossumlinkissue1597 messages
2007-12-12 20:26:14gvanrossumcreate