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: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: churchr, nnorwitz (2)
Priority: normal Keywords

Created on 2004-11-17 01:10 by churchr, last changed 2004-11-17 01:47 by nnorwitz.

Messages (2)
msg23175 - (view) Author: Robert Church (churchr) Date: 2004-11-17 01:10
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
msg23176 - (view) Author: Neal Norwitz (nnorwitz) Date: 2004-11-17 01:47
Logged In: YES 
user_id=33168

Dupe of 1067728
History
Date User Action Args
2004-11-17 01:10:40churchrcreate