classification
Title: Overflow error seek()ing with float values > (2 ** 31) - 1
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: churchr, rhettinger (2)
Priority: normal Keywords

Created on 2004-11-17 00:07 by churchr, last changed 2004-11-18 06:26 by rhettinger.

Messages (2)
msg23170 - (view) Author: Robert Church (churchr) Date: 2004-11-17 00:07
Passing a floating point value greater than (2**31) - 1
yields the exception:

OverflowError: long int too long to convert to int

# e.g., 

fh = open("/dev/zero", "rb")
fh.seek((2.0 ** 31) - 1)   # <--- works fine.

fh = open("/dev/zero", "rb")
fh.seek(2.0 ** 31)  # <--- throws the above  exception.

# Contrast with the behaviour with integers:

fh.seek(2 ** 31)  # works fine
fh.seek((2 ** 63) - 1)  # works fine
fh.seek(2 ** 63)  # throws the exception
msg23171 - (view) Author: Raymond Hettinger (rhettinger) Date: 2004-11-18 06:26
Logged In: YES 
user_id=80475

This seems like reasonable behavior to me.  If it did work
for some reason, it would be asking for hard to find user
bugs.  Closing as won't fix.
History
Date User Action Args
2004-11-17 00:07:48churchrcreate