]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #12011: signal.signal() and signal.siginterrupt() raise an OSError,
authorVictor Stinner <victor.stinner@haypocalc.com>
Tue, 10 May 2011 15:13:00 +0000 (17:13 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Tue, 10 May 2011 15:13:00 +0000 (17:13 +0200)
instead of a RuntimeError: OSError has an errno attribute.

Doc/whatsnew/3.3.rst
Misc/NEWS
Modules/signalmodule.c

index e657af24720264144c00a5b2d993a606f2e7a42a..d4426655d14e52f99c8e1fbc26e8d67cfb06cb9c 100644 (file)
@@ -148,6 +148,9 @@ signal
   a nul byte into the wakeup file descriptor. So it is possible to wait more
   than one signal and know which signals were raised.
 
+* :func:`signal.signal` and :func:`signal.siginterrupt` raise an OSError,
+  instead of a RuntimeError: OSError has an errno attribute.
+
 
 Optimizations
 =============
index 5953d30a0798feb1ac7afb784782870bb05dca59..2b0529e789760e3499c3fc6dc719d183d0e6b45a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -143,6 +143,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #12011: signal.signal() and signal.siginterrupt() raise an OSError,
+  instead of a RuntimeError: OSError has an errno attribute.
+
 - Issue #3709: a flush_headers method to BaseHTTPRequestHandler which manages
   the sending of headers to output stream and flushing the internal headers
   buffer. Patch contribution by Andrew Schaaf
index e5046691a6e1a897e7e56af84d4a8b1e3e8dc749..feeae5e212e43a85c9cfe8f68a81f3cb036dc696 100644 (file)
@@ -324,7 +324,7 @@ signal_signal(PyObject *self, PyObject *args)
     else
         func = signal_handler;
     if (PyOS_setsig(sig_num, func) == SIG_ERR) {
-        PyErr_SetFromErrno(PyExc_RuntimeError);
+        PyErr_SetFromErrno(PyExc_OSError);
         return NULL;
     }
     old_handler = Handlers[sig_num].func;
@@ -393,7 +393,7 @@ signal_siginterrupt(PyObject *self, PyObject *args)
         return NULL;
     }
     if (siginterrupt(sig_num, flag)<0) {
-        PyErr_SetFromErrno(PyExc_RuntimeError);
+        PyErr_SetFromErrno(PyExc_OSError);
         return NULL;
     }