Skip to content

Commit e878cca

Browse files
committed
Representative of a backport of python#131821 ?
1 parent 1749b3c commit e878cca

1 file changed

Lines changed: 13 additions & 11 deletions

File tree

Modules/socketmodule.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -716,12 +716,6 @@ select_error(void)
716716
# define SOCK_INPROGRESS_ERR EINPROGRESS
717717
#endif
718718

719-
#ifdef _MSC_VER
720-
# define SUPPRESS_DEPRECATED_CALL __pragma(warning(suppress: 4996))
721-
#else
722-
# define SUPPRESS_DEPRECATED_CALL
723-
#endif
724-
725719
/* Convenience function to raise an error according to errno
726720
and return a NULL pointer from a function. */
727721

@@ -3372,7 +3366,7 @@ sock_setsockopt(PyObject *self, PyObject *args)
33723366
&level, &optname, &flag)) {
33733367
#ifdef MS_WINDOWS
33743368
if (optname == SIO_TCP_SET_ACK_FREQUENCY) {
3375-
int dummy;
3369+
DWORD dummy;
33763370
res = WSAIoctl(get_sock_fd(s), SIO_TCP_SET_ACK_FREQUENCY, &flag,
33773371
sizeof(flag), NULL, 0, &dummy, NULL, NULL);
33783372
if (res >= 0) {
@@ -6204,8 +6198,10 @@ socket_gethostbyname_ex(PyObject *self, PyObject *args)
62046198
#ifdef USE_GETHOSTBYNAME_LOCK
62056199
PyThread_acquire_lock(netdb_lock, 1);
62066200
#endif
6207-
SUPPRESS_DEPRECATED_CALL
6201+
_Py_COMP_DIAG_PUSH
6202+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
62086203
h = gethostbyname(name);
6204+
_Py_COMP_DIAG_POP
62096205
#endif /* HAVE_GETHOSTBYNAME_R */
62106206
Py_END_ALLOW_THREADS
62116207
/* Some C libraries would require addr.__ss_family instead of
@@ -6309,8 +6305,10 @@ socket_gethostbyaddr(PyObject *self, PyObject *args)
63096305
#ifdef USE_GETHOSTBYNAME_LOCK
63106306
PyThread_acquire_lock(netdb_lock, 1);
63116307
#endif
6312-
SUPPRESS_DEPRECATED_CALL
6308+
_Py_COMP_DIAG_PUSH
6309+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
63136310
h = gethostbyaddr(ap, al, af);
6311+
_Py_COMP_DIAG_POP
63146312
#endif /* HAVE_GETHOSTBYNAME_R */
63156313
Py_END_ALLOW_THREADS
63166314
ret = gethost_common(state, h, SAS2SA(&addr), sizeof(addr), af);
@@ -6727,8 +6725,10 @@ _socket_inet_aton_impl(PyObject *module, const char *ip_addr)
67276725
packed_addr = INADDR_BROADCAST;
67286726
} else {
67296727

6730-
SUPPRESS_DEPRECATED_CALL
6728+
_Py_COMP_DIAG_PUSH
6729+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
67316730
packed_addr = inet_addr(ip_addr);
6731+
_Py_COMP_DIAG_POP
67326732

67336733
if (packed_addr == INADDR_NONE) { /* invalid address */
67346734
PyErr_SetString(PyExc_OSError,
@@ -6771,8 +6771,10 @@ _socket_inet_ntoa_impl(PyObject *module, Py_buffer *packed_ip)
67716771
memcpy(&packed_addr, packed_ip->buf, packed_ip->len);
67726772
PyBuffer_Release(packed_ip);
67736773

6774-
SUPPRESS_DEPRECATED_CALL
6774+
_Py_COMP_DIAG_PUSH
6775+
_Py_COMP_DIAG_IGNORE_DEPR_DECLS
67756776
return PyUnicode_FromString(inet_ntoa(packed_addr));
6777+
_Py_COMP_DIAG_POP
67766778
}
67776779
#endif // HAVE_INET_NTOA
67786780

0 commit comments

Comments
 (0)