Skip to content

Commit a256028

Browse files
tiranremykarem
authored andcommitted
bpo-40280: Add configure check for socket shutdown (pythonGH-29795)
1 parent f5aebab commit a256028

File tree

6 files changed

+15
-2
lines changed

6 files changed

+15
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
``configure`` now checks for socket ``shutdown`` function. The check makes
2+
it possible to disable ``SYS_shutdown`` with ``ac_cv_func_shutdown=no`` in
3+
CONFIG_SITE.

Modules/socketmodule.c

+4
Original file line numberDiff line numberDiff line change
@@ -4788,6 +4788,7 @@ Set operation mode, IV and length of associated data for an AF_ALG\n\
47884788
operation socket.");
47894789
#endif
47904790

4791+
#ifdef HAVE_SHUTDOWN
47914792
/* s.shutdown(how) method */
47924793

47934794
static PyObject *
@@ -4812,6 +4813,7 @@ PyDoc_STRVAR(shutdown_doc,
48124813
\n\
48134814
Shut down the reading side of the socket (flag == SHUT_RD), the writing side\n\
48144815
of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).");
4816+
#endif
48154817

48164818
#if defined(MS_WINDOWS) && defined(SIO_RCVALL)
48174819
static PyObject*
@@ -4957,8 +4959,10 @@ static PyMethodDef sock_methods[] = {
49574959
gettimeout_doc},
49584960
{"setsockopt", (PyCFunction)sock_setsockopt, METH_VARARGS,
49594961
setsockopt_doc},
4962+
#ifdef HAVE_SHUTDOWN
49604963
{"shutdown", (PyCFunction)sock_shutdown, METH_O,
49614964
shutdown_doc},
4965+
#endif
49624966
#ifdef CMSG_LEN
49634967
{"recvmsg", (PyCFunction)sock_recvmsg, METH_VARARGS,
49644968
recvmsg_doc},

PC/pyconfig.h

+3
Original file line numberDiff line numberDiff line change
@@ -517,6 +517,9 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
517517
/* Define if you have siginterrupt. */
518518
/* #undef HAVE_SIGINTERRUPT */
519519

520+
/* Define to 1 if you have the `shutdown' function. */
521+
#define HAVE_SHUTDOWN 1
522+
520523
/* Define if you have symlink. */
521524
/* #undef HAVE_SYMLINK */
522525

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -13395,7 +13395,7 @@ for ac_func in alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
1339513395
setgid sethostname \
1339613396
setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \
1339713397
sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
13398-
sched_rr_get_interval \
13398+
sched_rr_get_interval shutdown \
1339913399
sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
1340013400
sigtimedwait sigwait sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \
1340113401
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \

configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -3956,7 +3956,7 @@ AC_CHECK_FUNCS(alarm accept4 setitimer getitimer bind_textdomain_codeset chown \
39563956
setgid sethostname \
39573957
setlocale setregid setreuid setresuid setresgid setsid setpgid setpgrp setpriority setuid setvbuf \
39583958
sched_get_priority_max sched_setaffinity sched_setscheduler sched_setparam \
3959-
sched_rr_get_interval \
3959+
sched_rr_get_interval shutdown \
39603960
sigaction sigaltstack sigfillset siginterrupt sigpending sigrelse \
39613961
sigtimedwait sigwait sigwaitinfo snprintf splice strftime strlcpy strsignal symlinkat sync \
39623962
sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \

pyconfig.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,9 @@
992992
/* Define to 1 if you have the `shm_unlink' function. */
993993
#undef HAVE_SHM_UNLINK
994994

995+
/* Define to 1 if you have the `shutdown' function. */
996+
#undef HAVE_SHUTDOWN
997+
995998
/* Define to 1 if you have the `sigaction' function. */
996999
#undef HAVE_SIGACTION
9971000

0 commit comments

Comments
 (0)