Kaydet (Commit) a136d497 authored tarafından Fred Drake's avatar Fred Drake

Remove a lot of the confusing conditional compilation from the beginning

of the init_socket() function.  This module is now *always* _socket.
üst a6070f02
...@@ -2331,40 +2331,8 @@ OS2init(void) ...@@ -2331,40 +2331,8 @@ OS2init(void)
*/ */
static char module_doc[] = static char module_doc[] =
"This module provides socket operations and some related functions.\n\ "Implementation module for socket operations. See the socket module\n\
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.\n\ for documentation.";
On other systems, it only supports IP.\n\
\n\
Functions:\n\
\n\
socket() -- create a new socket object\n\
fromfd() -- create a socket object from an open file descriptor (*)\n\
gethostname() -- return the current hostname\n\
gethostbyname() -- map a hostname to its IP number\n\
gethostbyaddr() -- map an IP number or hostname to DNS info\n\
getservbyname() -- map a service name and a protocol name to a port number\n\
getprotobyname() -- mape a protocol name (e.g. 'tcp') to a number\n\
ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order\n\
htons(), htonl() -- convert 16, 32 bit int from host to network byte order\n\
inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format\n\
inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)\n\
ssl() -- secure socket layer support (only available if configured)\n\
\n\
(*) not available on all platforms!)\n\
\n\
Special objects:\n\
\n\
SocketType -- type object for socket objects\n\
error -- exception raised for I/O errors\n\
\n\
Integer constants:\n\
\n\
AF_INET, AF_UNIX -- socket domains (first argument to socket() call)\n\
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)\n\
\n\
Many other constants may be defined; these may be used in calls to\n\
the setsockopt() and getsockopt() methods.\n\
";
static char sockettype_doc[] = static char sockettype_doc[] =
"A socket represents one endpoint of a network connection.\n\ "A socket represents one endpoint of a network connection.\n\
...@@ -2394,30 +2362,19 @@ shutdown() -- shut down traffic in one or both directions\n\ ...@@ -2394,30 +2362,19 @@ shutdown() -- shut down traffic in one or both directions\n\
(*) not available on all platforms!)"; (*) not available on all platforms!)";
DL_EXPORT(void) DL_EXPORT(void)
#if defined(MS_WINDOWS) || defined(PYOS_OS2) || defined(__BEOS__)
init_socket(void) init_socket(void)
#else
initsocket(void)
#endif
{ {
PyObject *m, *d; PyObject *m, *d;
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
if (!NTinit()) if (!NTinit())
return; return;
m = Py_InitModule3("_socket", PySocket_methods, module_doc);
#else #else
#if defined(__TOS_OS2__) #if defined(__TOS_OS2__)
if (!OS2init()) if (!OS2init())
return; return;
#endif /* __TOS_OS2__ */
#endif /* MS_WINDOWS */
m = Py_InitModule3("_socket", PySocket_methods, module_doc); m = Py_InitModule3("_socket", PySocket_methods, module_doc);
#else
#if defined(__BEOS__)
m = Py_InitModule3("_socket", PySocket_methods, module_doc);
#else
m = Py_InitModule3("socket", PySocket_methods, module_doc);
#endif /* __BEOS__ */
#endif
#endif
d = PyModule_GetDict(m); d = PyModule_GetDict(m);
PySocket_Error = PyErr_NewException("socket.error", NULL, NULL); PySocket_Error = PyErr_NewException("socket.error", NULL, NULL);
if (PySocket_Error == NULL) if (PySocket_Error == NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment