[Python-checkins] CVS: python/dist/src/Modules socketmodule.c,1.137,1.138

Guido van Rossum gvanrossum@users.sourceforge.net
2001年3月01日 22:27:14 -0800


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv12191
Modified Files:
	socketmodule.c 
Log Message:
RISCOS changes by dschwertberger.
Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.137
retrieving revision 1.138
diff -C2 -r1.137 -r1.138
*** socketmodule.c	2001年02月07日 20:41:17	1.137
--- socketmodule.c	2001年03月02日 06:27:12	1.138
***************
*** 124,127 ****
--- 124,142 ----
 #endif
 
+ #ifdef RISCOS
+ #define NO_DUP
+ #undef off_t
+ #undef uid_t
+ #undef gid_t
+ #undef errno
+ #include <signal.h>
+ #include "socklib.h"
+ #include "inetlib.h"
+ #include "netdb.h"
+ #include "unixlib.h"
+ #include "netinet/in.h"
+ #include "sys/ioctl.h"
+ #else /*RISCOS*/
+ 
 #include <sys/types.h>
 
***************
*** 149,152 ****
--- 164,170 ----
 #include <fcntl.h>
 #endif
+ 
+ #endif /*RISCOS*/
+ 
 #ifdef HAVE_SYS_UN_H
 #include <sys/un.h>
***************
*** 219,222 ****
--- 237,246 ----
 
 
+ #ifdef RISCOS
+ /* Global variable which is !=0 if Python is running in a RISC OS taskwindow */
+ static int taskwindow;
+ #endif
+ 
+ 
 /* Convenience function to raise an error according to errno
 and return a NULL pointer from a function. */
***************
*** 235,239 ****
 			{ WSAEINVAL, "Invalid argument" },
 			{ WSAEMFILE, "Too many open files" },
! 			{ WSAEWOULDBLOCK, 
 				"The socket operation could not complete "
 				"without blocking" },
--- 259,263 ----
 			{ WSAEINVAL, "Invalid argument" },
 			{ WSAEMFILE, "Too many open files" },
! 			{ WSAEWOULDBLOCK,
 				"The socket operation could not complete "
 				"without blocking" },
***************
*** 255,261 ****
 			{ WSAENETDOWN, "Network is down" },
 			{ WSAENETUNREACH, "Network is unreachable" },
! 			{ WSAENETRESET, 
 				"Network dropped connection on reset" },
! 			{ WSAECONNABORTED, 
 				"Software caused connection abort" },
 			{ WSAECONNRESET, "Connection reset by peer" },
--- 279,285 ----
 			{ WSAENETDOWN, "Network is down" },
 			{ WSAENETUNREACH, "Network is unreachable" },
! 			{ WSAENETRESET,
 				"Network dropped connection on reset" },
! 			{ WSAECONNABORTED,
 				"Software caused connection abort" },
 			{ WSAECONNRESET, "Connection reset by peer" },
***************
*** 282,286 ****
 			{ WSAVERNOTSUPPORTED,
 				"WinSock version is not supported" },
! 			{ WSANOTINITIALISED, 
 				"Successful WSAStartup() not yet performed" },
 			{ WSAEDISCON, "Graceful shutdown in progress" },
--- 306,310 ----
 			{ WSAVERNOTSUPPORTED,
 				"WinSock version is not supported" },
! 			{ WSANOTINITIALISED,
 				"Successful WSAStartup() not yet performed" },
 			{ WSAEDISCON, "Graceful shutdown in progress" },
***************
*** 296,300 ****
 		PyObject *v;
 		const char *msg = "winsock error";
! 		
 		for (msgp = msgs; msgp->msg; msgp++) {
 			if (err_no == msgp->no) {
--- 320,324 ----
 		PyObject *v;
 		const char *msg = "winsock error";
! 
 		for (msgp = msgs; msgp->msg; msgp++) {
 			if (err_no == msgp->no) {
***************
*** 364,368 ****
 #if defined(linux) && defined(AF_PACKET)
 		struct sockaddr_ll ll;
! #endif		
 	} sock_addr;
 } PySocketSockObject;
--- 388,392 ----
 #if defined(linux) && defined(AF_PACKET)
 		struct sockaddr_ll ll;
! #endif
 	} sock_addr;
 } PySocketSockObject;
***************
*** 390,394 ****
 
 #endif /* USE_SSL */
! 
 /* A forward reference to the Socktype type object.
 The Socktype variable contains pointers to various functions,
--- 414,418 ----
 
 #endif /* USE_SSL */
! 
 /* A forward reference to the Socktype type object.
 The Socktype variable contains pointers to various functions,
***************
*** 407,410 ****
--- 431,437 ----
 PySocketSock_New(SOCKET_T fd, int family, int type, int proto)
 {
+ #ifdef RISCOS
+ 	int block = 1;
+ #endif
 	PySocketSockObject *s;
 	PySocketSock_Type.ob_type = &PyType_Type;
***************
*** 415,418 ****
--- 442,450 ----
 		s->sock_type = type;
 		s->sock_proto = proto;
+ #ifdef RISCOS
+ 		if(taskwindow) {
+ 			socketioctl(s->sock_fd, 0x80046679, (u_long*)&block);
+ 		}
+ #endif
 	}
 	return s;
***************
*** 420,424 ****
 
 
! /* Lock to allow python interpreter to continue, but only allow one 
 thread to be in gethostbyname */
 #ifdef USE_GETHOSTBYNAME_LOCK
--- 452,456 ----
 
 
! /* Lock to allow python interpreter to continue, but only allow one
 thread to be in gethostbyname */
 #ifdef USE_GETHOSTBYNAME_LOCK
***************
*** 492,497 ****
 	if (hp == NULL) {
 #ifdef HAVE_HSTRERROR
! 	 /* Let's get real error message to return */
! 	 extern int h_errno;
 		PyErr_SetString(PySocket_Error, (char *)hstrerror(h_errno));
 #else
--- 524,529 ----
 	if (hp == NULL) {
 #ifdef HAVE_HSTRERROR
! 		/* Let's get real error message to return */
! 		extern int h_errno;
 		PyErr_SetString(PySocket_Error, (char *)hstrerror(h_errno));
 #else
***************
*** 583,591 ****
 		}
 		return Py_BuildValue("shbhs#", ifname, ntohs(a->sll_protocol),
! 				 a->sll_pkttype, a->sll_hatype, 
! a->sll_addr, a->sll_halen);
 	}
 #endif
! 
 	/* More cases here... */
 
--- 615,623 ----
 		}
 		return Py_BuildValue("shbhs#", ifname, ntohs(a->sll_protocol),
! 				 a->sll_pkttype, a->sll_hatype,
! 				 a->sll_addr, a->sll_halen);
 	}
 #endif
! 
 	/* More cases here... */
 
***************
*** 608,612 ****
 
 static int
! getsockaddrarg(PySocketSockObject *s, PyObject *args, 
 	 struct sockaddr **addr_ret, int *len_ret)
 {
--- 640,644 ----
 
 static int
! getsockaddrarg(PySocketSockObject *s, PyObject *args,
 	 struct sockaddr **addr_ret, int *len_ret)
 {
***************
*** 669,673 ****
 		int pkttype = 0;
 		char *haddr;
! 		
 		if (!PyArg_ParseTuple(args, "si|iis", &interfaceName,
 				 &protoNumber, &pkttype, &hatype, &haddr))
--- 701,705 ----
 		int pkttype = 0;
 		char *haddr;
! 
 		if (!PyArg_ParseTuple(args, "si|iis", &interfaceName,
 				 &protoNumber, &pkttype, &hatype, &haddr))
***************
*** 689,695 ****
 		return 1;
 	}
! #endif 
! 
! 
 	/* More cases here... */
 
--- 721,727 ----
 		return 1;
 	}
! #endif
! 
! 
 	/* More cases here... */
 
***************
*** 702,706 ****
 
 
! /* Get the address length according to the socket object's address family. 
 Return 1 if the family is known, 0 otherwise. The length is returned
 through len_ret. */
--- 734,738 ----
 
 
! /* Get the address length according to the socket object's address family.
 Return 1 if the family is known, 0 otherwise. The length is returned
 through len_ret. */
***************
*** 732,736 ****
 	}
 #endif
! 		
 	/* More cases here... */
 
--- 764,768 ----
 	}
 #endif
! 
 	/* More cases here... */
 
***************
*** 779,783 ****
 		goto finally;
 	}
! 	addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, 
 			 addrlen);
 	if (addr == NULL)
--- 811,815 ----
 		goto finally;
 	}
! 	addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf,
 			 addrlen);
 	if (addr == NULL)
***************
*** 806,812 ****
--- 838,846 ----
 {
 	int block;
+ #ifndef RISCOS
 #ifndef MS_WINDOWS
 	int delay_flag;
 #endif
+ #endif
 	if (!PyArg_ParseTuple(args, "i:setblocking", &block))
 		return NULL;
***************
*** 817,820 ****
--- 851,855 ----
 				(void *)(&block), sizeof( int ) );
 #else
+ #ifndef RISCOS
 #ifndef MS_WINDOWS
 #ifdef PYOS_OS2
***************
*** 834,837 ****
--- 869,873 ----
 #endif /* MS_WINDOWS */
 #endif /* __BEOS__ */
+ #endif /* RISCOS */
 	Py_END_ALLOW_THREADS
 
***************
*** 847,850 ****
--- 883,910 ----
 
 
+ #ifdef RISCOS
+ /* s.sleeptaskw(1 | 0) method */
+ 
+ static PyObject *
+ PySocketSock_sleeptaskw(PySocketSockObject *s,PyObject *args)
+ {
+ int block;
+ int delay_flag;
+ if (!PyArg_GetInt(args, &block))
+ return NULL;
+ Py_BEGIN_ALLOW_THREADS
+ socketioctl(s->sock_fd, 0x80046679, (u_long*)&block);
+ Py_END_ALLOW_THREADS
+ 
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ static char sleeptaskw_doc[] =
+ "sleeptaskw(flag)\n\
+ \n\
+ Allow sleeps in taskwindows.";
+ #endif
+ 
+ 
 /* s.setsockopt() method.
 With an integer third argument, sets an integer option.
***************
*** 910,914 ****
 			 &level, &optname, &buflen))
 		return NULL;
! 	
 	if (buflen == 0) {
 		int flag = 0;
--- 970,974 ----
 			 &level, &optname, &buflen))
 		return NULL;
! 
 	if (buflen == 0) {
 		int flag = 0;
***************
*** 1216,1220 ****
 #else
 	int fd;
! #endif	
 	FILE *fp;
 	PyObject *f;
--- 1276,1280 ----
 #else
 	int fd;
! #endif
 	FILE *fp;
 	PyObject *f;
***************
*** 1246,1251 ****
 
 #endif /* NO_DUP */
 
- 
 /* s.recv(nbytes [,flags]) method */
 
--- 1306,1311 ----
 
 #endif /* NO_DUP */
+ 
 
 /* s.recv(nbytes [,flags]) method */
 
***************
*** 1319,1323 ****
 	if (n != len && _PyString_Resize(&buf, n) < 0)
 		return NULL;
! 		
 	if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, addrlen)))
 		goto finally;
--- 1379,1383 ----
 	if (n != len && _PyString_Resize(&buf, n) < 0)
 		return NULL;
! 
 	if (!(addr = makesockaddr(s->sock_fd, (struct sockaddr *)addrbuf, addrlen)))
 		goto finally;
***************
*** 1421,1468 ****
 
 static PyMethodDef PySocketSock_methods[] = {
! 	{"accept",		(PyCFunction)PySocketSock_accept, METH_VARARGS,
! 				accept_doc},
! 	{"bind",		(PyCFunction)PySocketSock_bind, METH_VARARGS,
! 				bind_doc},
! 	{"close",		(PyCFunction)PySocketSock_close, METH_VARARGS,
! 				close_doc},
! 	{"connect",		(PyCFunction)PySocketSock_connect, METH_VARARGS,
! 				connect_doc},
! 	{"connect_ex",		(PyCFunction)PySocketSock_connect_ex, METH_VARARGS,
! 				connect_ex_doc},
 #ifndef NO_DUP
! 	{"dup",			(PyCFunction)PySocketSock_dup, METH_VARARGS,
! 				dup_doc},
 #endif
! 	{"fileno",		(PyCFunction)PySocketSock_fileno, METH_VARARGS,
! 				fileno_doc},
 #ifdef HAVE_GETPEERNAME
! 	{"getpeername",		(PyCFunction)PySocketSock_getpeername, METH_VARARGS,
! 				getpeername_doc},
 #endif
! 	{"getsockname",		(PyCFunction)PySocketSock_getsockname, METH_VARARGS,
! 				getsockname_doc},
! 	{"getsockopt",		(PyCFunction)PySocketSock_getsockopt, METH_VARARGS,
! 				getsockopt_doc},
! 	{"listen",		(PyCFunction)PySocketSock_listen, METH_VARARGS,
! 				listen_doc},
 #ifndef NO_DUP
! 	{"makefile",		(PyCFunction)PySocketSock_makefile, METH_VARARGS,
! 				makefile_doc},
 #endif
! 	{"recv",		(PyCFunction)PySocketSock_recv, METH_VARARGS,
! 				recv_doc},
! 	{"recvfrom",		(PyCFunction)PySocketSock_recvfrom, METH_VARARGS,
! 				recvfrom_doc},
! 	{"send",		(PyCFunction)PySocketSock_send, METH_VARARGS,
! 				send_doc},
! 	{"sendto",		(PyCFunction)PySocketSock_sendto, METH_VARARGS,
! 				sendto_doc},
! 	{"setblocking",		(PyCFunction)PySocketSock_setblocking, METH_VARARGS,
! 				setblocking_doc},
! 	{"setsockopt",		(PyCFunction)PySocketSock_setsockopt, METH_VARARGS,
! 				setsockopt_doc},
! 	{"shutdown",		(PyCFunction)PySocketSock_shutdown, METH_VARARGS,
! 				shutdown_doc},
 	{NULL,			NULL}		/* sentinel */
 };
--- 1481,1532 ----
 
 static PyMethodDef PySocketSock_methods[] = {
! 	{"accept",	(PyCFunction)PySocketSock_accept, METH_VARARGS,
! 			accept_doc},
! 	{"bind",	(PyCFunction)PySocketSock_bind, METH_VARARGS,
! 			bind_doc},
! 	{"close",	(PyCFunction)PySocketSock_close, METH_VARARGS,
! 			close_doc},
! 	{"connect",	(PyCFunction)PySocketSock_connect, METH_VARARGS,
! 			connect_doc},
! 	{"connect_ex",	(PyCFunction)PySocketSock_connect_ex, METH_VARARGS,
! 			connect_ex_doc},
 #ifndef NO_DUP
! 	{"dup",		(PyCFunction)PySocketSock_dup, METH_VARARGS,
! 			dup_doc},
 #endif
! 	{"fileno",	(PyCFunction)PySocketSock_fileno, METH_VARARGS,
! 			fileno_doc},
 #ifdef HAVE_GETPEERNAME
! 	{"getpeername",	(PyCFunction)PySocketSock_getpeername, METH_VARARGS,
! 			getpeername_doc},
 #endif
! 	{"getsockname",	(PyCFunction)PySocketSock_getsockname, METH_VARARGS,
! 			getsockname_doc},
! 	{"getsockopt",	(PyCFunction)PySocketSock_getsockopt, METH_VARARGS,
! 			getsockopt_doc},
! 	{"listen",	(PyCFunction)PySocketSock_listen, METH_VARARGS,
! 			listen_doc},
 #ifndef NO_DUP
! 	{"makefile",	(PyCFunction)PySocketSock_makefile, METH_VARARGS,
! 			makefile_doc},
 #endif
! 	{"recv",	(PyCFunction)PySocketSock_recv, METH_VARARGS,
! 			recv_doc},
! 	{"recvfrom",	(PyCFunction)PySocketSock_recvfrom, METH_VARARGS,
! 			recvfrom_doc},
! 	{"send",	(PyCFunction)PySocketSock_send, METH_VARARGS,
! 			send_doc},
! 	{"sendto",	(PyCFunction)PySocketSock_sendto, METH_VARARGS,
! 			sendto_doc},
! 	{"setblocking",	(PyCFunction)PySocketSock_setblocking, METH_VARARGS,
! 			setblocking_doc},
! 	{"setsockopt",	(PyCFunction)PySocketSock_setsockopt, METH_VARARGS,
! 			setsockopt_doc},
! 	{"shutdown",	(PyCFunction)PySocketSock_shutdown, METH_VARARGS,
! 			shutdown_doc},
! #ifdef RISCOS
! 	{"sleeptaskw",	(PyCFunction)PySocketSock_sleeptaskw, METH_VARARGS,
! 	 		sleeptaskw_doc},
! #endif
 	{NULL,			NULL}		/* sentinel */
 };
***************
*** 1504,1509 ****
 	}
 #endif
! 	sprintf(buf, 
! 		"<socket object, fd=%ld, family=%d, type=%d, protocol=%d>", 
 		(long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto);
 	return PyString_FromString(buf);
--- 1568,1573 ----
 	}
 #endif
! 	sprintf(buf,
! 		"<socket object, fd=%ld, family=%d, type=%d, protocol=%d>",
 		(long)s->sock_fd, s->sock_family, s->sock_type, s->sock_proto);
 	return PyString_FromString(buf);
***************
*** 1589,1594 ****
 	if (h == NULL) {
 #ifdef HAVE_HSTRERROR
! 	 /* Let's get real error message to return */
! 	 extern int h_errno;
 		PyErr_SetString(PySocket_Error, (char *)hstrerror(h_errno));
 #else
--- 1653,1658 ----
 	if (h == NULL) {
 #ifdef HAVE_HSTRERROR
! 		/* Let's get real error message to return */
! 		extern int h_errno;
 		PyErr_SetString(PySocket_Error, (char *)hstrerror(h_errno));
 #else
***************
*** 1695,1699 ****
 PySocket_gethostbyaddr(PyObject *self, PyObject *args)
 {
! struct sockaddr_in addr;
 	char *ip_num;
 	struct hostent *h;
--- 1759,1763 ----
 PySocket_gethostbyaddr(PyObject *self, PyObject *args)
 {
! 	struct sockaddr_in addr;
 	char *ip_num;
 	struct hostent *h;
***************
*** 1727,1731 ****
 	h = gethostbyaddr_r((char *)&addr.sin_addr,
 			 sizeof(addr.sin_addr),
! 			 AF_INET, 
 			 &hp_allocated, buf, buf_len, &errnop);
 #else /* HAVE_GETHOSTBYNAME_R_3_ARG */
--- 1791,1795 ----
 	h = gethostbyaddr_r((char *)&addr.sin_addr,
 			 sizeof(addr.sin_addr),
! 			 AF_INET,
 			 &hp_allocated, buf, buf_len, &errnop);
 #else /* HAVE_GETHOSTBYNAME_R_3_ARG */
***************
*** 1851,1857 ****
 	/* From now on, ignore SIGPIPE and let the error checking
 	 do the work. */
! #ifdef SIGPIPE 
 	(void) signal(SIGPIPE, SIG_IGN);
! #endif 
 	return (PyObject *) s;
 }
--- 1915,1921 ----
 	/* From now on, ignore SIGPIPE and let the error checking
 	 do the work. */
! #ifdef SIGPIPE
 	(void) signal(SIGPIPE, SIG_IGN);
! #endif
 	return (PyObject *) s;
 }
***************
*** 1889,1895 ****
 	/* From now on, ignore SIGPIPE and let the error checking
 	 do the work. */
! #ifdef SIGPIPE 
 	(void) signal(SIGPIPE, SIG_IGN);
! #endif 
 	return (PyObject *) s;
 }
--- 1953,1959 ----
 	/* From now on, ignore SIGPIPE and let the error checking
 	 do the work. */
! #ifdef SIGPIPE
 	(void) signal(SIGPIPE, SIG_IGN);
! #endif
 	return (PyObject *) s;
 }
***************
*** 1982,1986 ****
 */
 
! static char inet_aton_doc[] = 
 "inet_aton(string) -> packed 32-bit IP representation\n\
 \n\
--- 2046,2050 ----
 */
 
! static char inet_aton_doc[] =
 "inet_aton(string) -> packed 32-bit IP representation\n\
 \n\
***************
*** 2018,2022 ****
 }
 
! static char inet_ntoa_doc[] = 
 "inet_ntoa(packed_ip) -> ip_address_string\n\
 \n\
--- 2082,2086 ----
 }
 
! static char inet_ntoa_doc[] =
 "inet_ntoa(packed_ip) -> ip_address_string\n\
 \n\
***************
*** 2033,2037 ****
 		return NULL;
 	}
! 	
 	if (addr_len != sizeof(packed_addr)) {
 		PyErr_SetString(PySocket_Error,
--- 2097,2101 ----
 		return NULL;
 	}
! 
 	if (addr_len != sizeof(packed_addr)) {
 		PyErr_SetString(PySocket_Error,
***************
*** 2061,2066 ****
 	}
 	memset(self->server, '0円', sizeof(char) * 256);
! 	memset(self->issuer, '0円', sizeof(char) * 256); 
! 
 	self->x_attr = PyDict_New();
 	self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */
--- 2125,2130 ----
 	}
 	memset(self->server, '0円', sizeof(char) * 256);
! 	memset(self->issuer, '0円', sizeof(char) * 256);
! 
 	self->x_attr = PyDict_New();
 	self->ctx = SSL_CTX_new(SSLv23_method()); /* Set up context */
***************
*** 2139,2148 ****
 	char *key_file;
 	char *cert_file;
! 
 	if (!PyArg_ParseTuple(args, "O!zz:ssl",
 			 &PySocketSock_Type, (PyObject*)&Sock,
 			 &key_file, &cert_file) )
 		return NULL;
! 
 	rv = newSSLObject(Sock, key_file, cert_file);
 	if ( rv == NULL )
--- 2203,2212 ----
 	char *key_file;
 	char *cert_file;
! 
 	if (!PyArg_ParseTuple(args, "O!zz:ssl",
 			 &PySocketSock_Type, (PyObject*)&Sock,
 			 &key_file, &cert_file) )
 		return NULL;
! 
 	rv = newSSLObject(Sock, key_file, cert_file);
 	if ( rv == NULL )
***************
*** 2218,2225 ****
 	char *data;
 	size_t len;
! 
 	if (!PyArg_ParseTuple(args, "s#:write", &data, &len))
 		return NULL;
! 
 	len = SSL_write(self->ssl, data, len);
 	return PyInt_FromLong((long)len);
--- 2282,2289 ----
 	char *data;
 	size_t len;
! 
 	if (!PyArg_ParseTuple(args, "s#:write", &data, &len))
 		return NULL;
! 
 	len = SSL_write(self->ssl, data, len);
 	return PyInt_FromLong((long)len);
***************
*** 2232,2241 ****
 	int len = 1024;
 	int res;
! 
 	PyArg_ParseTuple(args, "|i:read", &len);
! 
 	if (!(buf = PyString_FromStringAndSize((char *) 0, len)))
 		return NULL;	/* Error object should already be set */
! 
 	count = SSL_read(self->ssl, PyString_AsString(buf), len);
 	res = SSL_get_error(self->ssl, count);
--- 2296,2305 ----
 	int len = 1024;
 	int res;
! 
 	PyArg_ParseTuple(args, "|i:read", &len);
! 
 	if (!(buf = PyString_FromStringAndSize((char *) 0, len)))
 		return NULL;	/* Error object should already be set */
! 
 	count = SSL_read(self->ssl, PyString_AsString(buf), len);
 	res = SSL_get_error(self->ssl, count);
***************
*** 2251,2262 ****
 		return PyErr_SetFromErrno(SSLErrorObject);
 	}
! 
 	fflush(stderr);
! 	 
 	if (count < 0) {
 		Py_DECREF(buf);
 		return PyErr_SetFromErrno(SSLErrorObject);
 	}
! 
 	if (count != len && _PyString_Resize(&buf, count) < 0)
 		return NULL;
--- 2315,2326 ----
 		return PyErr_SetFromErrno(SSLErrorObject);
 	}
! 
 	fflush(stderr);
! 
 	if (count < 0) {
 		Py_DECREF(buf);
 		return PyErr_SetFromErrno(SSLErrorObject);
 	}
! 
 	if (count != len && _PyString_Resize(&buf, count) < 0)
 		return NULL;
***************
*** 2270,2305 ****
 
 static PyMethodDef PySocket_methods[] = {
! 	{"gethostbyname",	PySocket_gethostbyname, 
 	 METH_VARARGS, gethostbyname_doc},
! 	{"gethostbyname_ex",	PySocket_gethostbyname_ex, 
 	 METH_VARARGS, ghbn_ex_doc},
! 	{"gethostbyaddr",	PySocket_gethostbyaddr, 
 	 METH_VARARGS, gethostbyaddr_doc},
! 	{"gethostname",		PySocket_gethostname, 
 	 METH_VARARGS, gethostname_doc},
! 	{"getservbyname",	PySocket_getservbyname, 
 	 METH_VARARGS, getservbyname_doc},
! 	{"getprotobyname",	PySocket_getprotobyname, 
 	 METH_VARARGS,getprotobyname_doc},
! 	{"socket",		PySocket_socket, 
 	 METH_VARARGS, socket_doc},
 #ifndef NO_DUP
! 	{"fromfd",		PySocket_fromfd, 
 	 METH_VARARGS, fromfd_doc},
 #endif
! 	{"ntohs",		PySocket_ntohs, 
 	 METH_VARARGS, ntohs_doc},
! 	{"ntohl",		PySocket_ntohl, 
 	 METH_VARARGS, ntohl_doc},
! 	{"htons",		PySocket_htons, 
 	 METH_VARARGS, htons_doc},
! 	{"htonl",		PySocket_htonl, 
 	 METH_VARARGS, htonl_doc},
! 	{"inet_aton",		PySocket_inet_aton, 
 	 METH_VARARGS, inet_aton_doc},
! 	{"inet_ntoa",		PySocket_inet_ntoa, 
 	 METH_VARARGS, inet_ntoa_doc},
 #ifdef USE_SSL
! 	{"ssl",			PySocket_ssl, 
 	 METH_VARARGS, ssl_doc},
 #endif /* USE_SSL */
--- 2334,2369 ----
 
 static PyMethodDef PySocket_methods[] = {
! 	{"gethostbyname",	PySocket_gethostbyname,
 	 METH_VARARGS, gethostbyname_doc},
! 	{"gethostbyname_ex",	PySocket_gethostbyname_ex,
 	 METH_VARARGS, ghbn_ex_doc},
! 	{"gethostbyaddr",	PySocket_gethostbyaddr,
 	 METH_VARARGS, gethostbyaddr_doc},
! 	{"gethostname",		PySocket_gethostname,
 	 METH_VARARGS, gethostname_doc},
! 	{"getservbyname",	PySocket_getservbyname,
 	 METH_VARARGS, getservbyname_doc},
! 	{"getprotobyname",	PySocket_getprotobyname,
 	 METH_VARARGS,getprotobyname_doc},
! 	{"socket",		PySocket_socket,
 	 METH_VARARGS, socket_doc},
 #ifndef NO_DUP
! 	{"fromfd",		PySocket_fromfd,
 	 METH_VARARGS, fromfd_doc},
 #endif
! 	{"ntohs",		PySocket_ntohs,
 	 METH_VARARGS, ntohs_doc},
! 	{"ntohl",		PySocket_ntohl,
 	 METH_VARARGS, ntohl_doc},
! 	{"htons",		PySocket_htons,
 	 METH_VARARGS, htons_doc},
! 	{"htonl",		PySocket_htonl,
 	 METH_VARARGS, htonl_doc},
! 	{"inet_aton",		PySocket_inet_aton,
 	 METH_VARARGS, inet_aton_doc},
! 	{"inet_ntoa",		PySocket_inet_ntoa,
 	 METH_VARARGS, inet_ntoa_doc},
 #ifdef USE_SSL
! 	{"ssl",			PySocket_ssl,
 	 METH_VARARGS, ssl_doc},
 #endif /* USE_SSL */
***************
*** 2446,2449 ****
--- 2510,2519 ----
 {
 	PyObject *m, *d;
+ #ifdef RISCOS
+ 	_kernel_swi_regs r;
+ 	r.r[0]=0;
+ 	_kernel_swi(0x43380, &r, &r);
+ 	taskwindow = r.r[0];
+ #else
 #ifdef MS_WINDOWS
 	if (!NTinit())
***************
*** 2455,2458 ****
--- 2525,2529 ----
 #endif /* __TOS_OS2__ */
 #endif /* MS_WINDOWS */
+ #endif /* RISCOS */
 #ifdef USE_SSL
 	SSL_Type.ob_type = &PyType_Type;
***************
*** 2528,2532 ****
 	insint(d, "PACKET_LOOPBACK", PACKET_LOOPBACK);
 	insint(d, "PACKET_FASTROUTE", PACKET_FASTROUTE);
! #endif	
 
 	/* Socket types */
--- 2599,2603 ----
 	insint(d, "PACKET_LOOPBACK", PACKET_LOOPBACK);
 	insint(d, "PACKET_FASTROUTE", PACKET_FASTROUTE);
! #endif
 
 	/* Socket types */

AltStyle によって変換されたページ (->オリジナル) /