[Python-checkins] python/dist/src/Objects floatobject.c,2.110.6.2,2.110.6.3

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Tue, 28 Jan 2003 11:40:41 -0800


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

Modified Files:
      Tag: release22-maint
	floatobject.c 
Log Message:
backport:
Fix SF bug# 676155, RuntimeWarning with tp_compare

Check return value of PyLong_AsDouble(), it can return an error.


Index: floatobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v
retrieving revision 2.110.6.2
retrieving revision 2.110.6.3
diff -C2 -d -r2.110.6.2 -r2.110.6.3
*** floatobject.c	12 May 2002 17:20:38 -0000	2.110.6.2
--- floatobject.c	28 Jan 2003 19:40:35 -0000	2.110.6.3
***************
*** 626,630 ****
  	}
  	else if (PyLong_Check(*pw)) {
! 		*pw = PyFloat_FromDouble(PyLong_AsDouble(*pw));
  		Py_INCREF(*pv);
  		return 0;
--- 626,633 ----
  	}
  	else if (PyLong_Check(*pw)) {
! 		double x = PyLong_AsDouble(*pw);
! 		if (x == -1.0 && PyErr_Occurred())
! 			return -1;
! 		*pw = PyFloat_FromDouble(x);
  		Py_INCREF(*pv);
  		return 0;