[Python-checkins] python/dist/src/Modules socketmodule.c,1.236,1.237

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Thu, 25 Jul 2002 09:37:53 -0700


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

Modified Files:
	socketmodule.c 
Log Message:
Put checks for error returns in the right place.


Index: socketmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/socketmodule.c,v
retrieving revision 1.236
retrieving revision 1.237
diff -C2 -d -r1.236 -r1.237
*** socketmodule.c	25 Jul 2002 16:01:12 -0000	1.236
--- socketmodule.c	25 Jul 2002 16:37:51 -0000	1.237
***************
*** 2476,2482 ****
--- 2476,2486 ----
  	if (PyInt_Check(arg)) {
  		x = PyInt_AS_LONG(arg);
+ 		if (x == (unsigned long) -1 && PyErr_Occurred())
+ 			return NULL;
  	}
  	else if (PyLong_Check(arg)) {
  		x = PyLong_AsUnsignedLong(arg);
+ 		if (x == (unsigned long) -1 && PyErr_Occurred())
+ 			return NULL;
  #if SIZEOF_LONG > 4
  		{
***************
*** 2531,2537 ****
--- 2535,2545 ----
  	if (PyInt_Check(arg)) {
  		x = PyInt_AS_LONG(arg);
+ 		if (x == (unsigned long) -1 && PyErr_Occurred())
+ 			return NULL;
  	}
  	else if (PyLong_Check(arg)) {
  		x = PyLong_AsUnsignedLong(arg);
+ 		if (x == (unsigned long) -1 && PyErr_Occurred())
+ 			return NULL;
  #if SIZEOF_LONG > 4
  		{
***************
*** 2550,2555 ****
  				    "expected int/long, %s found",
  				    arg->ob_type->tp_name);
- 	if (x == (unsigned long) -1 && PyErr_Occurred())
- 		return NULL;
  	return PyInt_FromLong(htonl(x));
  }
--- 2558,2561 ----