mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
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.
This commit is contained in:
parent
fa12c6bae4
commit
07d0b95b05
2 changed files with 9 additions and 1 deletions
|
|
@ -0,0 +1,2 @@
|
||||||
|
Handle :data:`~errno.ECANCELED` in the same way as :data:`~errno.EINTR` in
|
||||||
|
:func:`signal.sigwaitinfo` on NetBSD.
|
||||||
|
|
@ -1183,7 +1183,13 @@ signal_sigwaitinfo_impl(PyObject *module, sigset_t sigset)
|
||||||
err = sigwaitinfo(&sigset, &si);
|
err = sigwaitinfo(&sigset, &si);
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS
|
||||||
} while (err == -1
|
} 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)
|
if (err == -1)
|
||||||
return (!async_err) ? PyErr_SetFromErrno(PyExc_OSError) : NULL;
|
return (!async_err) ? PyErr_SetFromErrno(PyExc_OSError) : NULL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue