On Sat, Jun 13, 2009 at 9:40 AM, Facundo
Batistafacundobati...@gmail.com wrote:
How about a nice 'n shiny context wrapper for the pipe:
I'll do this!
Thank you for the suggestion!
Boo, I can not take this approach, neither the previous one.
The reason is very specific for subprocess.py...
On Tue, 16 Jun 2009 01:20:53 pm Cameron Simpson wrote:
I don't think all
pythons do immediate ref-counted GC.
Jython and IronPython don't. I don't know about PyPy, CLPython, Unladen
Swallow, etc.
--
Steven D'Aprano
___
Python-Dev mailing list
Steven D'Aprano wrote:
On Tue, 16 Jun 2009 01:20:53 pm Cameron Simpson wrote:
I don't think all
pythons do immediate ref-counted GC.
Jython and IronPython don't. I don't know about PyPy, CLPython, Unladen
Swallow, etc.
PyPy doesn't, Unladen Swallow won't.
Michael
--
On Tue, Jun 16, 2009 at 1:21 PM, Michael Foordfuzzy...@voidspace.org.uk wrote:
Steven D'Aprano wrote:
On Tue, 16 Jun 2009 01:20:53 pm Cameron Simpson wrote:
I don't think all pythons do immediate ref-counted GC.
Jython and IronPython don't. I don't know about PyPy, CLPython, Unladen
Swallow,
Cameron Simpson c...@zip.com.au wrote:
On 14Jun2009 16:42, Mark Seaborn m...@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,
On 14Jun2009 16:42, Mark Seaborn m...@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
Facundo Batista facundobati...@gmail.com wrote:
errpipe_read, errpipe_write = os.pipe()
try:
try:
.
.
.
.
.
.
finally:
os.close(errpipe_write)
.
.
.
finally:
On Fri, Jun 12, 2009 at 9:06 PM, Christian Heimesli...@cheimes.de wrote:
How about a nice 'n shiny context wrapper for the pipe:
I'll do this!
Thank you for the suggestion!
BTW, as this is a good way of avoiding the FD leakage, should this
context wrapper for pipe() be in the stdlib?
In a long lived process at work, we started leaking file descriptors.
The problem were that subprocess.Popen._execute_child() method creates
two files descriptors through a call to os.pipe(), and after some work
it closes them. But an os.read() on the descriptor was interrupted
(EINTR), so an
Facundo Batista wrote:
I just don't like a huge try/finally... but as FDs are just ints, do
you think is there a better way to handle it?
How about a nice 'n shiny context wrapper for the pipe:
import os
class Pipe(object):
def __enter__(self):
self.read, self.write = os.pipe()
Facundo Batista wrote:
I just don't like a huge try/finally... but as FDs are just ints, do
you think is there a better way to handle it?
How about a nice 'n shiny context wrapper for the pipe:
import os
class Pipe(object):
def __enter__(self):
self.read, self.write = os.pipe()
11 matches
Mail list logo