"long int..." exception reported with strange traceback location

Michael Hoffman cam.ac.uk at mh391.invalid
Mon Jul 4 22:42:09 CEST 2005

Joe Peterson wrote:
> I could not find another example of this via internet searches, so here
> it is...  I am wondering if this is a python bug or otherwise.  The
> first example of this happened in a larger program of mine, and the
> traceback reports the problem at the start of a "for" loop (making no
> sense), but I cannot easily include the full code and instructions here.
> So I wrote a small test program containing the offending code, and in
> this case the traceback reports the problem happening "during garbage
> collection."  So in either case, there's something funny going on here.
>  The call the causes it is "os.utime()".  Note that the trigger is a
> rediculous timezone value that causes an overflow.  But the surprize is
> that the traceback does not report its happening in utime.

I came up with a simpler testcase. Strangely, the exception occurs in 
the statement *following* the os.utime() call:

 >>> import os, sys
 >>> os.utime("foo_test_file", (0, float(sys.maxint+1)))
 >>> print "hi"
OverflowError: long int too large to convert to int

Looks like a bug. You should report it on the SourceForge tracker.
Michael Hoffman

More information about the Python-list mailing list