classification
Title: asyncio's loop.connect_read_pipe makes pipes non-blocking contrary to the documentation
Type: behavior Stage:
Components: Documentation Versions: Python 3.4, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: John Isidore, docs@python, gvanrossum, python-dev, vstinner
Priority: normal Keywords:

Created on 2014-05-08 19:05 by John Isidore, last changed 2014-05-28 22:20 by vstinner. This issue is now closed.

Messages (4)
msg218120 - (view) Author: (John Isidore) Date: 2014-05-08 19:05
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
msg218122 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2014-05-08 20:21
Thanks for the report, that should be easy to fix.

Regarding PTYs, we're aware: https://code.google.com/p/tulip/issues/detail?id=147
msg219313 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2014-05-28 22:19
New changeset 16f399588b2a by Victor Stinner in branch '3.4':
Issue #21454: Fix asyncio.BaseEventLoop.connect_read_pipe doc
http://hg.python.org/cpython/rev/16f399588b2a

New changeset 8391f99208f6 by Victor Stinner in branch 'default':
(Merge 3.4) Issue #21454: Fix asyncio.BaseEventLoop.connect_read_pipe doc
http://hg.python.org/cpython/rev/8391f99208f6
msg219314 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2014-05-28 22:20
Yes, the documentation was wrong. It should now be fixed. Thanks for the report.
History
Date User Action Args
2014-05-28 22:20:03vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg219314
2014-05-28 22:19:21python-devsetnosy: + python-dev
messages: + msg219313
2014-05-08 20:21:36gvanrossumsetnosy: + vstinner
messages: + msg218122
2014-05-08 19:05:06John Isidorecreate