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.
This commit is contained in:
parent
89487f51b8
commit
48ce4897f8
|
@ -60,6 +60,7 @@ class PosixTests(unittest.TestCase):
|
||||||
def test_strsignal(self):
|
def test_strsignal(self):
|
||||||
self.assertIn("Interrupt", signal.strsignal(signal.SIGINT))
|
self.assertIn("Interrupt", signal.strsignal(signal.SIGINT))
|
||||||
self.assertIn("Terminated", signal.strsignal(signal.SIGTERM))
|
self.assertIn("Terminated", signal.strsignal(signal.SIGTERM))
|
||||||
|
self.assertIn("Hangup", signal.strsignal(signal.SIGHUP))
|
||||||
|
|
||||||
# Issue 3864, unknown if this affects earlier versions of freebsd also
|
# Issue 3864, unknown if this affects earlier versions of freebsd also
|
||||||
def test_interprocess_signal(self):
|
def test_interprocess_signal(self):
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Make :func:`signal.strsignal` work on HP-UX. Patch by Michael Osipov.
|
|
@ -530,9 +530,27 @@ signal_strsignal_impl(PyObject *module, int signalnum)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MS_WINDOWS
|
#ifndef HAVE_STRSIGNAL
|
||||||
/* Custom redefinition of POSIX signals allowed on Windows */
|
|
||||||
switch (signalnum) {
|
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:
|
case SIGINT:
|
||||||
res = "Interrupt";
|
res = "Interrupt";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -11256,7 +11256,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
|
||||||
sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
|
sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
|
||||||
sched_rr_get_interval \
|
sched_rr_get_interval \
|
||||||
sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
|
sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
|
||||||
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat sync \
|
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy strsignal symlinkat sync \
|
||||||
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
|
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
|
||||||
truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
|
truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
|
||||||
wcscoll wcsftime wcsxfrm wmemcmp writev _getpty
|
wcscoll wcsftime wcsxfrm wmemcmp writev _getpty
|
||||||
|
|
|
@ -3448,7 +3448,7 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
|
||||||
sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
|
sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
|
||||||
sched_rr_get_interval \
|
sched_rr_get_interval \
|
||||||
sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
|
sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
|
||||||
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy symlinkat sync \
|
sigtimedwait sigwait sigwaitinfo snprintf strftime strlcpy strsignal symlinkat sync \
|
||||||
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
|
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \
|
||||||
truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
|
truncate uname unlinkat unsetenv utimensat utimes waitid waitpid wait3 wait4 \
|
||||||
wcscoll wcsftime wcsxfrm wmemcmp writev _getpty)
|
wcscoll wcsftime wcsxfrm wmemcmp writev _getpty)
|
||||||
|
|
|
@ -984,6 +984,9 @@
|
||||||
/* Define to 1 if you have the <stropts.h> header file. */
|
/* Define to 1 if you have the <stropts.h> header file. */
|
||||||
#undef HAVE_STROPTS_H
|
#undef HAVE_STROPTS_H
|
||||||
|
|
||||||
|
/* Define to 1 if you have the `strsignal' function. */
|
||||||
|
#undef HAVE_STRSIGNAL
|
||||||
|
|
||||||
/* Define to 1 if `pw_gecos' is a member of `struct passwd'. */
|
/* Define to 1 if `pw_gecos' is a member of `struct passwd'. */
|
||||||
#undef HAVE_STRUCT_PASSWD_PW_GECOS
|
#undef HAVE_STRUCT_PASSWD_PW_GECOS
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue