Issue #27702: Only expose SOCK_RAW when defined

SOCK_RAW is marked as optional in the POSIX specification:

    http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_socket.h.html

Patch by Ed Schouten.
This commit is contained in:
Berker Peksag 2016-08-08 14:07:05 +03:00
parent e1d22fda7e
commit 95e0df8389
1 changed files with 3 additions and 0 deletions

View File

@ -6495,7 +6495,10 @@ PyInit__socket(void)
PyModule_AddIntMacro(m, SOCK_STREAM);
PyModule_AddIntMacro(m, SOCK_DGRAM);
/* We have incomplete socket support. */
#ifdef SOCK_RAW
/* SOCK_RAW is marked as optional in the POSIX specification */
PyModule_AddIntMacro(m, SOCK_RAW);
#endif
PyModule_AddIntMacro(m, SOCK_SEQPACKET);
#if defined(SOCK_RDM)
PyModule_AddIntMacro(m, SOCK_RDM);