https://github.com/python/cpython/commit/07d0b95b05dfaf5832f44c2fbc956761f9e29571
commit: 07d0b95b05dfaf5832f44c2fbc956761f9e29571
branch: main
author: Serhiy Storchaka <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2025-09-15T19:20:31+03:00
summary:
gh-137490: Fix signal.sigwaitinfo() on NetBSD (GH-137523)
Handle ECANCELED in the same way as EINTR to work around the Posix
violation in the NetBSD's implementation.
files:
A Misc/NEWS.d/next/Library/2025-08-07-17-18-57.gh-issue-137490.s89ieZ.rst
M Modules/signalmodule.c
diff --git
a/Misc/NEWS.d/next/Library/2025-08-07-17-18-57.gh-issue-137490.s89ieZ.rst
b/Misc/NEWS.d/next/Library/2025-08-07-17-18-57.gh-issue-137490.s89ieZ.rst
new file mode 100644
index 00000000000000..bcb0938b8e3acb
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2025-08-07-17-18-57.gh-issue-137490.s89ieZ.rst
@@ -0,0 +1,2 @@
+Handle :data:`~errno.ECANCELED` in the same way as :data:`~errno.EINTR` in
+:func:`signal.sigwaitinfo` on NetBSD.
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 02bfdab957fc52..3c79ef1429087a 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -1183,7 +1183,13 @@ signal_sigwaitinfo_impl(PyObject *module, sigset_t
sigset)
err = sigwaitinfo(&sigset, &si);
Py_END_ALLOW_THREADS
} while (err == -1
- && errno == EINTR && !(async_err = PyErr_CheckSignals()));
+ && (errno == EINTR
+#if defined(__NetBSD__)
+ /* NetBSD's implementation violates POSIX by setting
+ * errno to ECANCELED instead of EINTR. */
+ || errno == ECANCELED
+#endif
+ ) && !(async_err = PyErr_CheckSignals()));
if (err == -1)
return (!async_err) ? PyErr_SetFromErrno(PyExc_OSError) : NULL;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]