A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2009-June/090076.html below:

[Python-Dev] Avoiding file descriptors leakage in subprocess.Popen()

[Python-Dev] Avoiding file descriptors leakage in subprocess.Popen() [Python-Dev] Avoiding file descriptors leakage in subprocess.Popen()Cameron Simpson cs at zip.com.au
Tue Jun 16 05:20:53 CEST 2009
On 14Jun2009 16:42, Mark Seaborn <mrs at mythic-beasts.com> wrote:
| I use a convenience function like this, so that GC takes care of the FDs:
| 
| def make_pipe():
|     read_fd, write_fd = os.pipe()
|     return os.fdopen(read_fd, "r"), os.fdopen(write_fd, "w")

Not guarrenteed to be timely. The try/except at least closes things as
control passes out of the relevant scope. I don't think all pythons
do immediate ref-counted GC.

But it's very neat!
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Trust the computer industry to shorten Year 2000 to Y2K. It was this
thinking that caused the problem in the first place.
- Mark Ovens <marko at uk.radan.com>
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4