[Python-checkins] python/dist/src/Modules selectmodule.c,2.67,2.68

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
2002年7月28日 08:12:13 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv20169/Modules
Modified Files:
	selectmodule.c 
Log Message:
SF patch #577031, remove PyArg_Parse() since it's deprecated
Index: selectmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/selectmodule.c,v
retrieving revision 2.67
retrieving revision 2.68
diff -C2 -d -r2.67 -r2.68
*** selectmodule.c	23 Jul 2002 06:31:13 -0000	2.67
--- selectmodule.c	28 Jul 2002 15:12:10 -0000	2.68
***************
*** 209,213 ****
 	if (tout == Py_None)
 		tvp = (struct timeval *)0;
! 	else if (!PyArg_Parse(tout, "d", &timeout)) {
 		PyErr_SetString(PyExc_TypeError,
 				"timeout must be a float or None");
--- 209,213 ----
 	if (tout == Py_None)
 		tvp = (struct timeval *)0;
! 	else if (!PyNumber_Check(tout)) {
 		PyErr_SetString(PyExc_TypeError,
 				"timeout must be a float or None");
***************
*** 215,218 ****
--- 215,223 ----
 	}
 	else {
+ 		tout = PyNumber_Float(tout);
+ 		if (!tout)
+ 			return NULL;
+ 		timeout = PyFloat_AS_DOUBLE(tout);
+ 		Py_DECREF(tout);
 		if (timeout > (double)LONG_MAX) {
 			PyErr_SetString(PyExc_OverflowError,
***************
*** 451,458 ****
 	if (tout == NULL || tout == Py_None)
 		timeout = -1;
! 	else if (!PyArg_Parse(tout, "i", &timeout)) {
 		PyErr_SetString(PyExc_TypeError,
 				"timeout must be an integer or None");
 		return NULL;
 	}
 
--- 456,470 ----
 	if (tout == NULL || tout == Py_None)
 		timeout = -1;
! 	else if (!PyNumber_Check(tout)) {
 		PyErr_SetString(PyExc_TypeError,
 				"timeout must be an integer or None");
 		return NULL;
+ 	}
+ 	else {
+ 		tout = PyNumber_Int(tout);
+ 		if (!tout)
+ 			return NULL;
+ 		timeout = PyInt_AS_LONG(tout);
+ 		Py_DECREF(tout);
 	}
 

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