[Python-checkins] CVS: python/dist/src/Objects floatobject.c,2.101,2.102

Guido van Rossum gvanrossum@users.sourceforge.net
Wed, 24 Oct 2001 13:39:14 -0700


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

Modified Files:
	floatobject.c 
Log Message:
SF patch #474590 -- RISC OS support

Index: floatobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/floatobject.c,v
retrieving revision 2.101
retrieving revision 2.102
diff -C2 -d -r2.101 -r2.102
*** floatobject.c	2001/10/05 20:51:38	2.101
--- floatobject.c	2001/10/24 20:39:12	2.102
***************
*** 611,614 ****
--- 611,621 ----
  
  	(void)modf(x, &wholepart);
+ #ifdef RISCOS
+ 	/* conversion from floating to integral type would raise exception */
+ 	if (wholepart>LONG_MAX || wholepart<LONG_MIN) {
+ 		PyErr_SetString(PyExc_OverflowError, "float too large to convert");
+ 		return NULL;
+ 	}
+ #endif
  	/* doubles may have more bits than longs, or vice versa; and casting
  	   to long may yield gibberish in either case.  What really matters