This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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
Priority: normal Keywords:

Created on 2004-11-17 00:07 by churchr, last changed 2022-04-11 14:56 by admin. This issue is now closed.

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) * (Python committer) 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
2022-04-11 14:56:08adminsetgithub: 41181
2004-11-17 00:07:48churchrcreate