[Python-checkins] python/dist/src/Modules socketmodule.c,1.267,1.268 timemodule.c,2.136,2.137 zipimport.c,1.13,1.14

loewis@users.sourceforge.net loewis@users.sourceforge.net
Sat, 10 May 2003 00:36:57 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv17284/Modules

Modified Files:
	socketmodule.c timemodule.c zipimport.c 
Log Message:
Patch #734231: Update RiscOS support. In particular, correct 
riscospath.extsep, and use os.extsep throughout.


Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.267
retrieving revision 1.268
diff -C2 -d -r1.267 -r1.268
*** socketmodule.c	9 May 2003 08:12:00 -0000	1.267
--- socketmodule.c	10 May 2003 07:36:55 -0000	1.268
***************
*** 222,228 ****
  #  include <fcntl.h>
  # else
! #  include <sys/fcntl.h>
  #  define NO_DUP
  int h_errno; /* not used */
  # endif
  
--- 222,230 ----
  #  include <fcntl.h>
  # else
! #  include <sys/ioctl.h>
! #  include <socklib.h>
  #  define NO_DUP
  int h_errno; /* not used */
+ #  define INET_ADDRSTRLEN 16
  # endif
  
***************
*** 465,468 ****
--- 467,482 ----
  #endif
  
+ #if defined(RISCOS)
+ 	if (_inet_error.errnum != NULL) {
+ 		PyObject *v;
+ 		v = Py_BuildValue("(is)", errno, _inet_err());
+ 		if (v != NULL) {
+ 			PyErr_SetObject(socket_error, v);
+ 			Py_DECREF(v);
+ 		}
+ 		return NULL;
+ 	}
+ #endif
+ 
  	return PyErr_SetFromErrno(socket_error);
  }
***************
*** 549,554 ****
  	ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block);
  #endif /* MS_WINDOWS */
! #endif /* __BEOS__ */
  #endif /* RISCOS */
  	Py_END_ALLOW_THREADS
  
--- 563,571 ----
  	ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block);
  #endif /* MS_WINDOWS */
! #else /* RISCOS */
! 	block = !block;
! 	socketioctl(s->sock_fd, FIONBIO, (u_long*)&block);
  #endif /* RISCOS */
+ #endif /* __BEOS__ */
  	Py_END_ALLOW_THREADS
  
***************
*** 1212,1220 ****
  
  static PyObject *
! sock_sleeptaskw(PySocketSockObject *s,PyObject *args)
  {
  	int block;
! 	int delay_flag;
! 	if (!PyArg_Parse(args, "i", &block))
  		return NULL;
  	Py_BEGIN_ALLOW_THREADS
--- 1229,1237 ----
  
  static PyObject *
! sock_sleeptaskw(PySocketSockObject *s,PyObject *arg)
  {
  	int block;
! 	block = PyInt_AsLong(arg);
! 	if (block == -1 && PyErr_Occurred())
  		return NULL;
  	Py_BEGIN_ALLOW_THREADS
***************
*** 2057,2061 ****
  			shutdown_doc},
  #ifdef RISCOS
! 	{"sleeptaskw",	(PyCFunction)sock_sleeptaskw, METH_VARARGS,
  	 		sleeptaskw_doc},
  #endif
--- 2074,2078 ----
  			shutdown_doc},
  #ifdef RISCOS
! 	{"sleeptaskw",	(PyCFunction)sock_sleeptaskw, METH_O,
  	 		sleeptaskw_doc},
  #endif
***************
*** 2859,2864 ****
  	char* ip;
  	int retval;
  	char packed[MAX(sizeof(struct in_addr), sizeof(struct in6_addr))];
! 
  	if (!PyArg_ParseTuple(args, "is:inet_pton", &af, &ip)) {
  		return NULL;
--- 2876,2884 ----
  	char* ip;
  	int retval;
+ #ifdef ENABLE_IPV6
  	char packed[MAX(sizeof(struct in_addr), sizeof(struct in6_addr))];
! #else
! 	char packed[sizeof(struct in_addr)];
! #endif
  	if (!PyArg_ParseTuple(args, "is:inet_pton", &af, &ip)) {
  		return NULL;
***************
*** 2876,2882 ****
--- 2896,2904 ----
  		return PyString_FromStringAndSize(packed,
  			sizeof(struct in_addr));
+ #ifdef ENABLE_IPV6
  	} else if (af == AF_INET6) {
  		return PyString_FromStringAndSize(packed,
  			sizeof(struct in6_addr));
+ #endif
  	} else {
  		PyErr_SetString(socket_error, "unknown address family");
***************
*** 2897,2901 ****
--- 2919,2927 ----
  	int len;
  	const char* retval;
+ #ifdef ENABLE_IPV6
  	char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1];
+ #else
+ 	char ip[INET_ADDRSTRLEN + 1];
+ #endif
  	
  	/* Guarantee NUL-termination for PyString_FromString() below */
***************
*** 2912,2915 ****
--- 2938,2942 ----
  			return NULL;
  		}
+ #ifdef ENABLE_IPV6
  	} else if (af == AF_INET6) {
  		if (len != sizeof(struct in6_addr)) {
***************
*** 2918,2921 ****
--- 2945,2949 ----
  			return NULL;
  		}
+ #endif
  	} else {
  		PyErr_Format(PyExc_ValueError,
***************
*** 3236,3240 ****
  	taskwindow = r.r[0];
  
! 	return 0;
  }
  
--- 3264,3268 ----
  	taskwindow = r.r[0];
  
! 	return 1;
  }
  

Index: timemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v
retrieving revision 2.136
retrieving revision 2.137
diff -C2 -d -r2.136 -r2.137
*** timemodule.c	10 Apr 2003 16:03:22 -0000	2.136
--- timemodule.c	10 May 2003 07:36:55 -0000	2.137
***************
*** 79,82 ****
--- 79,86 ----
  #endif
  
+ #ifdef RISCOS
+ extern int riscos_sleep(double);
+ #endif
+ 
  /* Forward declarations */
  static int floatsleep(double);
***************
*** 945,949 ****
  	Py_BEGIN_ALLOW_THREADS
  	/* This sleep *CAN BE* interrupted. */
! 	if ( sleep(secs) )
  		return -1;
  	Py_END_ALLOW_THREADS
--- 949,953 ----
  	Py_BEGIN_ALLOW_THREADS
  	/* This sleep *CAN BE* interrupted. */
! 	if ( riscos_sleep(secs) )
  		return -1;
  	Py_END_ALLOW_THREADS

Index: zipimport.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/zipimport.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** zipimport.c	8 Apr 2003 20:07:15 -0000	1.13
--- zipimport.c	10 May 2003 07:36:55 -0000	1.14
***************
*** 92,95 ****
--- 92,96 ----
  	prefix = NULL;
  	for (;;) {
+ #ifndef RISCOS
  		struct stat statbuf;
  		int rv;
***************
*** 103,106 ****
--- 104,116 ----
  			break;
  		}
+ #else
+ 		if (object_exists(buf)) {
+ 			/* it exists */
+ 			if (isfile(buf))
+ 				/* it's a file */
+ 				path = buf;
+ 			break;
+ 		}
+ #endif
  		/* back up one path element */
  		p = strrchr(buf, SEP);