On Sat, Jun 13, 2009 at 9:40 AM, Facundo
Batista 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... after creating the
Cameron Simpson wrote:
> On 14Jun2009 16:42, Mark Seaborn 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
On Tue, Jun 16, 2009 at 1:21 PM, Michael Foord 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, etc.
>
> PyPy
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
--
http://w
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
Py
On 14Jun2009 16:42, Mark Seaborn 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
Facundo Batista wrote:
> errpipe_read, errpipe_write = os.pipe()
> try:
> try:
> .
> .
> .
> .
> .
> .
> finally:
> os.close(errpipe_write)
> .
> .
> .
> finally:
> os.close(errpipe
On Fri, Jun 12, 2009 at 9:06 PM, Christian Heimes 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?
Regards,
--
.Facu
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()
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 exce
11 matches
Mail list logo