[Python-checkins] r52030 - in python/branches/release24-maint: Misc/NEWS Modules/posixmodule.c

andrew.kuchling python-checkins at python.org
Thu Sep 28 19:16:26 CEST 2006


Author: andrew.kuchling
Date: Thu Sep 28 19:16:25 2006
New Revision: 52030

Modified:
   python/branches/release24-maint/Misc/NEWS
   python/branches/release24-maint/Modules/posixmodule.c
Log:
[Backport rev. 39135 by mwh]

Fix bug

[ 1232517 ] OverflowError in time.utime() causes strange traceback

A needed error check was missing.

(Actually, this error check may only have become necessary in fairly
recent Python, not sure).

Backport candidate.

[A few lines below the code in 2.4 touched by the patch, there's already 
 a similar check of (intval == -1 && PyErr_Occurred()), so I think 
 this function can already report such errors, and therefore the fix
 still applies.  Perhaps Michael can clarify what he was referring to. --amk]


Modified: python/branches/release24-maint/Misc/NEWS
==============================================================================
--- python/branches/release24-maint/Misc/NEWS	(original)
+++ python/branches/release24-maint/Misc/NEWS	Thu Sep 28 19:16:25 2006
@@ -27,6 +27,9 @@
 
 - Bug #1524310: Properly report errors from FindNextFile in os.listdir.
 
+- Bug #1232517: An overflow error was not detected properly when
+  attempting to convert a large float to an int in os.utime().
+
 - Bug #927248: Recursive method-wrapper objects can now safely
   be released.
 

Modified: python/branches/release24-maint/Modules/posixmodule.c
==============================================================================
--- python/branches/release24-maint/Modules/posixmodule.c	(original)
+++ python/branches/release24-maint/Modules/posixmodule.c	Thu Sep 28 19:16:25 2006
@@ -2004,6 +2004,8 @@
 			return -1;
 		intval = PyInt_AsLong(intobj);
 		Py_DECREF(intobj);
+		if (intval == -1 && PyErr_Occurred())
+			return -1;
 		*sec = intval;
 		*usec = (long)((tval - intval) * 1e6); /* can't exceed 1000000 */
 		if (*usec < 0)


More information about the Python-checkins mailing list