Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-41498: Fix build on platforms without sigset_t (GH-29770) #29770

Merged
merged 1 commit into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Python now compiles on platforms without ``sigset_t``. Several functions
in :mod:`signal` are not available when ``sigset_t`` is missing.

Based on patch by Roman Yurchak for pyodide.
26 changes: 13 additions & 13 deletions Modules/clinic/signalmodule.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Modules/posixmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -5934,6 +5934,7 @@ parse_posix_spawn_flags(PyObject *module, const char *func_name, PyObject *setpg

}

#ifdef HAVE_SIGSET_T
if (setsigmask) {
sigset_t set;
if (!_Py_Sigset_Converter(setsigmask, &set)) {
Expand All @@ -5959,6 +5960,13 @@ parse_posix_spawn_flags(PyObject *module, const char *func_name, PyObject *setpg
}
all_flags |= POSIX_SPAWN_SETSIGDEF;
}
#else
if (setsigmask || setsigdef) {
PyErr_SetString(PyExc_NotImplementedError,
"sigset is not supported on this platform");
goto fail;
}
#endif

if (scheduler) {
#ifdef POSIX_SPAWN_SETSCHEDULER
Expand Down
2 changes: 0 additions & 2 deletions Modules/posixmodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ PyAPI_FUNC(int) _Py_Gid_Converter(PyObject *, gid_t *);
# define HAVE_SIGSET_T
#endif

#ifdef HAVE_SIGSET_T
PyAPI_FUNC(int) _Py_Sigset_Converter(PyObject *, void *);
#endif /* HAVE_SIGSET_T */
#endif /* Py_LIMITED_API */

#ifdef __cplusplus
Expand Down
13 changes: 10 additions & 3 deletions Modules/signalmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ module signal
[clinic start generated code]*/
/*[clinic end generated code: output=da39a3ee5e6b4b0d input=b0301a3bde5fe9d3]*/

#ifdef HAVE_SETSIG_T

/*[python input]

class sigset_t_converter(CConverter):
Expand All @@ -68,6 +70,7 @@ class sigset_t_converter(CConverter):

[python start generated code]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=b5689d14466b6823]*/
#endif

/*
NOTES ON THE INTERACTION BETWEEN SIGNALS AND THREADS
Expand Down Expand Up @@ -932,6 +935,7 @@ signal_getitimer_impl(PyObject *module, int which)
#endif // HAVE_GETITIMER


#ifdef HAVE_SIGSET_T
#if defined(PYPTHREAD_SIGMASK) || defined(HAVE_SIGPENDING)
static PyObject*
sigset_to_set(sigset_t mask)
Expand Down Expand Up @@ -1063,9 +1067,9 @@ signal_sigwait_impl(PyObject *module, sigset_t sigset)
}

#endif /* #ifdef HAVE_SIGWAIT */
#endif /* #ifdef HAVE_SIGSET_T */


#if defined(HAVE_SIGFILLSET) || defined(MS_WINDOWS)
#if (defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS)

/*[clinic input]
signal.valid_signals
Expand Down Expand Up @@ -1103,7 +1107,8 @@ signal_valid_signals_impl(PyObject *module)
#endif
}

#endif /* #if defined(HAVE_SIGFILLSET) || defined(MS_WINDOWS) */
#endif /* #if (defined(HAVE_SIGFILLSET) && defined(HAVE_SIGSET_T)) || defined(MS_WINDOWS) */



#if defined(HAVE_SIGWAITINFO) || defined(HAVE_SIGTIMEDWAIT)
Expand Down Expand Up @@ -1168,6 +1173,7 @@ fill_siginfo(siginfo_t *si)
}
#endif

#ifdef HAVE_SIGSET_T
#ifdef HAVE_SIGWAITINFO

/*[clinic input]
Expand Down Expand Up @@ -1270,6 +1276,7 @@ signal_sigtimedwait_impl(PyObject *module, sigset_t sigset,
}

#endif /* #ifdef HAVE_SIGTIMEDWAIT */
#endif /* #ifdef HAVE_SIGSET_T */


#if defined(HAVE_PTHREAD_KILL)
Expand Down