From 48ce4897f8f8d91d948ecd1241ffab002df2be9e Mon Sep 17 00:00:00 2001 From: Michael Osipov <1983-01-06@gmx.net> Date: Thu, 23 Aug 2018 15:27:19 +0200 Subject: bpo-34412: Make signal.strsignal() work on HP-UX (GH-8786) Introduce a configure check for strsignal(3) which defines HAVE_STRSIGNAL for signalmodule.c. Add some common signals on HP-UX. This change applies for Windows and HP-UX. --- Modules/signalmodule.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'Modules/signalmodule.c') diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index 9de5c2ed18..d120948582 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -530,9 +530,27 @@ signal_strsignal_impl(PyObject *module, int signalnum) return NULL; } -#ifdef MS_WINDOWS - /* Custom redefinition of POSIX signals allowed on Windows */ +#ifndef HAVE_STRSIGNAL switch (signalnum) { + /* Though being a UNIX, HP-UX does not provide strsignal(3). */ +#ifndef MS_WINDOWS + case SIGHUP: + res = "Hangup"; + break; + case SIGALRM: + res = "Alarm clock"; + break; + case SIGPIPE: + res = "Broken pipe"; + break; + case SIGQUIT: + res = "Quit"; + break; + case SIGCHLD: + res = "Child exited"; + break; +#endif + /* Custom redefinition of POSIX signals allowed on Windows. */ case SIGINT: res = "Interrupt"; break; -- cgit v1.2.1