Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3eca28c6
Commit
3eca28c6
authored
Mar 28, 2019
by
Giampaolo Rodola
Committed by
GitHub
Mar 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-29515: add missing socket.IPPROTO_* constants on Windows (GH-12183)
parent
8abd7c7e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
1 deletion
+92
-1
Lib/test/test_socket.py
Lib/test/test_socket.py
+19
-0
Misc/NEWS.d/next/Windows/2019-03-05-18-09-43.bpo-29515.vwUTv0.rst
...S.d/next/Windows/2019-03-05-18-09-43.bpo-29515.vwUTv0.rst
+27
-0
Modules/socketmodule.c
Modules/socketmodule.c
+46
-1
No files found.
Lib/test/test_socket.py
View file @
3eca28c6
...
...
@@ -867,6 +867,8 @@ class GeneralModuleTests(unittest.TestCase):
def
testCrucialConstants
(
self
):
# Testing for mission critical constants
socket
.
AF_INET
if
socket
.
has_ipv6
:
socket
.
AF_INET6
socket
.
SOCK_STREAM
socket
.
SOCK_DGRAM
socket
.
SOCK_RAW
...
...
@@ -875,6 +877,23 @@ class GeneralModuleTests(unittest.TestCase):
socket
.
SOL_SOCKET
socket
.
SO_REUSEADDR
def
testCrucialIpProtoConstants
(
self
):
socket
.
IPPROTO_TCP
socket
.
IPPROTO_UDP
if
socket
.
has_ipv6
:
socket
.
IPPROTO_IPV6
@
unittest
.
skipUnless
(
os
.
name
==
"nt"
,
"Windows specific"
)
def
testWindowsSpecificConstants
(
self
):
socket
.
IPPROTO_ICLFXBM
socket
.
IPPROTO_ST
socket
.
IPPROTO_CBT
socket
.
IPPROTO_IGP
socket
.
IPPROTO_RDP
socket
.
IPPROTO_PGM
socket
.
IPPROTO_L2TP
socket
.
IPPROTO_SCTP
def
testHostnameRes
(
self
):
# Testing hostname resolution mechanisms
hostname
=
socket
.
gethostname
()
...
...
Misc/NEWS.d/next/Windows/2019-03-05-18-09-43.bpo-29515.vwUTv0.rst
0 → 100644
View file @
3eca28c6
Add the following socket module constants on Windows:
IPPROTO_AH
IPPROTO_CBT
IPPROTO_DSTOPTS
IPPROTO_EGP
IPPROTO_ESP
IPPROTO_FRAGMENT
IPPROTO_GGP
IPPROTO_HOPOPTS
IPPROTO_ICLFXBM
IPPROTO_ICMPV6
IPPROTO_IDP
IPPROTO_IGMP
IPPROTO_IGP
IPPROTO_IPV4
IPPROTO_IPV6
IPPROTO_L2TP
IPPROTO_MAX
IPPROTO_ND
IPPROTO_NONE
IPPROTO_PGM
IPPROTO_PIM
IPPROTO_PUP
IPPROTO_RDP
IPPROTO_ROUTING
IPPROTO_SCTP
IPPROTO_ST
Modules/socketmodule.c
View file @
3eca28c6
...
...
@@ -309,6 +309,40 @@ http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/net/getaddrinfo.c.diff?r1=1.82&
# include <fcntl.h>
# endif
/* Macros based on the IPPROTO enum, see: https://bugs.python.org/issue29515 */
#ifdef MS_WINDOWS
#define IPPROTO_ICMP IPPROTO_ICMP
#define IPPROTO_IGMP IPPROTO_IGMP
#define IPPROTO_GGP IPPROTO_GGP
#define IPPROTO_TCP IPPROTO_TCP
#define IPPROTO_PUP IPPROTO_PUP
#define IPPROTO_UDP IPPROTO_UDP
#define IPPROTO_IDP IPPROTO_IDP
#define IPPROTO_ND IPPROTO_ND
#define IPPROTO_RAW IPPROTO_RAW
#define IPPROTO_MAX IPPROTO_MAX
#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
#define IPPROTO_IPV4 IPPROTO_IPV4
#define IPPROTO_IPV6 IPPROTO_IPV6
#define IPPROTO_ROUTING IPPROTO_ROUTING
#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
#define IPPROTO_ESP IPPROTO_ESP
#define IPPROTO_AH IPPROTO_AH
#define IPPROTO_ICMPV6 IPPROTO_ICMPV6
#define IPPROTO_NONE IPPROTO_NONE
#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
#define IPPROTO_EGP IPPROTO_EGP
#define IPPROTO_PIM IPPROTO_PIM
#define IPPROTO_ICLFXBM IPPROTO_ICLFXBM // WinSock2 only
#define IPPROTO_ST IPPROTO_ST // WinSock2 only
#define IPPROTO_CBT IPPROTO_CBT // WinSock2 only
#define IPPROTO_IGP IPPROTO_IGP // WinSock2 only
#define IPPROTO_RDP IPPROTO_RDP // WinSock2 only
#define IPPROTO_PGM IPPROTO_PGM // WinSock2 only
#define IPPROTO_L2TP IPPROTO_L2TP // WinSock2 only
#define IPPROTO_SCTP IPPROTO_SCTP // WinSock2 only
#endif
/* MS_WINDOWS */
/* Provides the IsWindows7SP1OrGreater() function */
#include <versionhelpers.h>
...
...
@@ -356,7 +390,7 @@ remove_unusable_flags(PyObject *m)
for
(
int
i
=
0
;
i
<
sizeof
(
win_runtime_flags
)
/
sizeof
(
FlagRuntimeInfo
);
i
++
)
{
info
.
dwBuildNumber
=
win_runtime_flags
[
i
].
build_number
;
/* greater than or equal to the specified version?
/* greater than or equal to the specified version?
Compatibility Mode will not cheat VerifyVersionInfo(...) */
if
(
VerifyVersionInfo
(
&
info
,
...
...
@@ -7659,6 +7693,17 @@ PyInit__socket(void)
PyModule_AddIntMacro
(
m
,
IPPROTO_MAX
);
#endif
#ifdef MS_WINDOWS
PyModule_AddIntMacro
(
m
,
IPPROTO_ICLFXBM
);
PyModule_AddIntMacro
(
m
,
IPPROTO_ST
);
PyModule_AddIntMacro
(
m
,
IPPROTO_CBT
);
PyModule_AddIntMacro
(
m
,
IPPROTO_IGP
);
PyModule_AddIntMacro
(
m
,
IPPROTO_RDP
);
PyModule_AddIntMacro
(
m
,
IPPROTO_PGM
);
PyModule_AddIntMacro
(
m
,
IPPROTO_L2TP
);
PyModule_AddIntMacro
(
m
,
IPPROTO_SCTP
);
#endif
#ifdef SYSPROTO_CONTROL
PyModule_AddIntMacro
(
m
,
SYSPROTO_CONTROL
);
#endif
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment