Mercurial > cpython-lru_cache-weakref
diff Modules/socketmodule.c @ 31027:bf038986cb8f legacy-trunk
Patch #849595: Add socket.shutdown() constants.
| author | Martin v. Löwis <martin@v.loewis.de> |
|---|---|
| date | Thu, 27 Nov 2003 19:40:22 +0000 |
| parents | 4c8160088b34 |
| children | f388e83f8e43 |
line wrap: on
line diff
--- a/Modules/socketmodule.c Wed Nov 26 20:55:49 2003 +0000 +++ b/Modules/socketmodule.c Thu Nov 27 19:40:22 2003 +0000 @@ -2097,8 +2097,8 @@ PyDoc_STRVAR(shutdown_doc, "shutdown(flag)\n\ \n\ -Shut down the reading side of the socket (flag == 0), the writing side\n\ -of the socket (flag == 1), or both ends (flag == 2)."); +Shut down the reading side of the socket (flag == SHUT_RD), the writing side\n\ +of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR)."); /* List of methods for socket objects */ @@ -4101,6 +4101,29 @@ PyModule_AddIntConstant(m, "NI_DGRAM", NI_DGRAM); #endif + /* shutdown() parameters */ +#ifdef SHUT_RD + PyModule_AddIntConstant(m, "SHUT_RD", SHUT_RD); +#elif defined(SD_RECEIVE) + PyModule_AddIntConstant(m, "SHUT_RD", SD_RECEIVE); +#else + PyModule_AddIntConstant(m, "SHUT_RD", 0); +#endif +#ifdef SHUT_WR + PyModule_AddIntConstant(m, "SHUT_WR", SHUT_WR); +#elif defined(SD_SEND) + PyModule_AddIntConstant(m, "SHUT_WR", SD_SEND); +#else + PyModule_AddIntConstant(m, "SHUT_WR", 1); +#endif +#ifdef SHUT_RDWR + PyModule_AddIntConstant(m, "SHUT_RDWR", SHUT_RDWR); +#elif defined(SD_BOTH) + PyModule_AddIntConstant(m, "SHUT_RDWR", SD_BOTH); +#else + PyModule_AddIntConstant(m, "SHUT_RDWR", 2); +#endif + /* Initialize gethostbyname lock */ #if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK) netdb_lock = PyThread_allocate_lock();
