[issue21454] asyncio's loop.connect_read_pipe makes pipes non-blocking contrary to the documentation

2014-05-08 Thread John Isidore

New submission from John Isidore:

the documentation for BaseEventLoop.connect_read_pipe says: 

> "pipe is file-like object **already switched** to nonblocking."

http://hg.python.org/cpython/file/232938736a31/Doc/library/asyncio-eventloop.rst#l453

But it looks like connect_read_pipe() accepts blocking pipes and switches
them to non-blocking mode:

> "It looks like connect_read_pipe() (eventually) sets the fd to non-blocking. 
> So it does work."

https://code.google.com/p/tulip/source/detail?r=0a716436176993a12cf861b6cafffe8a31bc1127

If it is indeed the case then the documentation should mention that it
accepts blocking pipes and makes them non-blocking.

May it break other processes by making the file non-blocking if it is a pty
that is shared between processes? 

Related: "Don't set shared file descriptors to non-blocking I/O mode."
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/dont-set-shared-file-descriptors-to-non-blocking-mode.html

--
assignee: docs@python
components: Documentation
messages: 218120
nosy: John Isidore, docs@python, gvanrossum
priority: normal
severity: normal
status: open
title: asyncio's loop.connect_read_pipe makes pipes non-blocking contrary to 
the documentation
type: behavior
versions: Python 3.4, Python 3.5

___
Python tracker 
<http://bugs.python.org/issue21454>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22389] Generalize contextlib.redirect_stdout

2014-09-29 Thread John Isidore

John Isidore added the comment:

There is stdout_redirected() function [1] that allows to redirect a file object 
given as `stdout` patameter including `sys.stderr`. It works at a file 
descriptor level i.e. it supports redirecting subprocess' output too but it 
doesn't work for StringIO (no fd).

[1] 
http://stackoverflow.com/questions/4675728/redirect-stdout-to-a-file-in-python/22434262#22434262

--
nosy: +John Isidore

___
Python tracker 
<http://bugs.python.org/issue22389>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com