[Python-checkins] peps: PEP 475: update the list of modified functions according to the implementation

victor.stinner python-checkins at python.org
Sun Apr 19 10:59:14 CEST 2015


https://hg.python.org/peps/rev/6f686f08d88c
changeset:   5773:6f686f08d88c
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Sun Apr 19 10:59:06 2015 +0200
summary:
  PEP 475: update the list of modified functions according to the implementation

Mention also the special case of socket.socket.connect().

files:
  pep-0475.txt |  79 +++++++++++++++++++++++++++++----------
  1 files changed, 58 insertions(+), 21 deletions(-)


diff --git a/pep-0475.txt b/pep-0475.txt
--- a/pep-0475.txt
+++ b/pep-0475.txt
@@ -168,37 +168,74 @@
 Example of standard library functions that need to be modified to comply
 with this PEP:
 
-* ``open()``, ``os.open()``
-* ``os.read()``, ``io.FileIO.read()``, ``io.FileIO.readinto()``
-* ``os.write()``, ``io.FileIO.write()``
-* ``os.waitpid()``
-* ``socket.accept()``
-* ``socket.connect()``
-* ``socket.recv()``, ``socket.recv_into()``
-* ``socket.recv_from()``
-* ``socket.send()``
-* ``socket.sendto()``
+* ``open()``, ``os.open()``, ``io.open()``
+* functions of the ``faulthandler`` module
+* ``os`` functions:
+
+  - ``os.fchdir()``
+  - ``os.fchmod()``
+  - ``os.fchown()``
+  - ``os.fdatasync()``
+  - ``os.fstat()``
+  - ``os.fstatvfs()``
+  - ``os.fsync()``
+  - ``os.ftruncate()``
+  - ``os.mkfifo()``
+  - ``os.mknod()``
+  - ``os.posix_fadvise()``
+  - ``os.posix_fallocate()``
+  - ``os.pread()``
+  - ``os.pwrite()``
+  - ``os.read()``
+  - ``os.readv()``
+  - ``os.sendfile()``
+  - ``os.wait3()``
+  - ``os.wait4()``
+  - ``os.wait()``
+  - ``os.waitid()``
+  - ``os.waitpid()``
+  - ``os.write()``
+  - ``os.writev()``
+  - special cases: ``os.close()`` and ``os.dup2()`` now ignore ``EINTR`` error,
+    the syscall is not retried
+
+* ``select.select()``, ``select.poll.poll()``, ``select.epoll.poll()``,
+  ``select.kqueue.control()``, ``select.devpoll.poll()``
+* ``socket.socket()`` methods:
+
+  - ``accept()``
+  - ``connect()`` (except for non-blocking sockets)
+  - ``recv()``
+  - ``recvfrom()``
+  - ``recvmsg()``
+  - ``send()``
+  - ``sendall()``
+  - ``sendmsg()``
+  - ``sendto()``
+
+* ``signal.sigtimedwait()``, ``signal.sigwaitinfo()``
 * ``time.sleep()``
-* ``select.select()``
-* ``select.poll()``
-* ``select.epoll.poll()``
-* ``select.devpoll.poll()``
-* ``select.kqueue.control()``
-* ``selectors.SelectSelector.select()`` and other selector classes
 
-(note: the ``selector`` module already retries on ``InterruptedError``, but it
+(Note: the ``selector`` module already retries on ``InterruptedError``, but it
 doesn't recompute the timeout yet)
 
-``os.close`` and ``close()`` methods are a special case: they will ignore
-EINTR instead of retrying.  The reason is complex but involves behaviour
-under Linux and the fact that the file descriptor may really be closed
-even if EINTR is returned. See articles:
+``os.close``, ``close()`` methods and ``os.dup2()`` are a special case: they
+will ignore ``EINTR`` instead of retrying.  The reason is complex but involves
+behaviour under Linux and the fact that the file descriptor may really be
+closed even if EINTR is returned. See articles:
 
 * `Returning EINTR from close() <http://lwn.net/Articles/576478/>`_
 * `(LKML) Re: [patch 7/7] uml: retry host close() on EINTR
   <http://linux.derkeiler.com/Mailing-Lists/Kernel/2005-09/3000.html>`_
 * `close() and EINTR <http://alobbs.com/post/54503240599/close-and-eintr>`_
 
+The ``socket.socket.connect()`` method does not retry ``connect()`` for
+non-blocking sockets if it is interrupted by a signal (fails with ``EINTR``).
+The connection runs asynchronously in background. The caller is responsible
+to wait until the socket becomes writable (ex: using ``select.select()``)
+and then call ``socket.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)``
+to check if the connection succeeded (``getsockopt()`` returns ``0``) or failed.
+
 
 InterruptedError handling
 -------------------------

-- 
Repository URL: https://hg.python.org/peps


More information about the Python-checkins mailing list