[Python-checkins] cpython: Issue #23836: Use _Py_write_noraise() to retry on EINTR in trip_signal() of

victor.stinner python-checkins at python.org
Wed Apr 1 18:51:56 CEST 2015


https://hg.python.org/cpython/rev/12e065efc821
changeset:   95357:12e065efc821
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Wed Apr 01 18:35:22 2015 +0200
summary:
  Issue #23836: Use _Py_write_noraise() to retry on EINTR in trip_signal() of
signalmodule.c

files:
  Modules/signalmodule.c |  7 ++++---
  1 files changed, 4 insertions(+), 3 deletions(-)


diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -263,9 +263,10 @@
 #endif
         {
             byte = (unsigned char)sig_num;
-            do {
-                rc = write(fd, &byte, 1);
-            } while (rc < 0 && errno == EINTR);
+
+            /* _Py_write_noraise() retries write() if write() is interrupted by
+               a signal (fails with EINTR). */
+            rc = _Py_write_noraise(fd, &byte, 1);
 
             if (rc < 0) {
                 Py_AddPendingCall(report_wakeup_write_error,

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


More information about the Python-checkins mailing list