[Python-checkins] CVS: python/dist/src/Misc NEWS,1.226,1.227
Tim Peters
tim_one@users.sourceforge.net
Mon, 03 Sep 2001 22:14:21 -0700
Update of /cvsroot/python/python/dist/src/Misc
In directory usw-pr-cvs1:/tmp/cvs-serv28101/python/Misc
Modified Files:
NEWS
Log Message:
Raise OverflowError when appropriate on long->float conversion. Most of
the fiddling is simply due to that no caller of PyLong_AsDouble ever
checked for failure (so that's fixing old bugs). PyLong_AsDouble is much
faster for big inputs now too, but that's more of a happy consequence
than a design goal.
Index: NEWS
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/NEWS,v
retrieving revision 1.226
retrieving revision 1.227
diff -C2 -d -r1.226 -r1.227
*** NEWS 2001/09/04 03:25:44 1.226
--- NEWS 2001/09/04 05:14:19 1.227
***************
*** 4,7 ****
--- 4,10 ----
Core
+ - Conversion of long to float now raises OverflowError if the long is too
+ big to represent as a C double.
+
- The 3-argument builtin pow() no longer allows a third non-None argument
if either of the first two arguments is a float, or if both are of
***************
*** 95,98 ****
--- 98,110 ----
API
+
+ - Note that PyLong_AsDouble can fail! This has always been true, but no
+ callers checked for it. It's more likely to fail now, because overflow
+ errors are properly detected now. The proper way to check:
+
+ double x = PyLong_AsDouble(some_long_object);
+ if (x == -1.0 && PyErr_Occurred()) {
+ /* The conversion failed. */
+ }
- The GC API has been changed. Extensions that use the old API will still