Message 153331 - Python tracker (original) (raw)

After thinking about it a bit more I am OK with Vinay's proposal. Attached is an updated patch.

Also, I also noticed that the 'struct' module has the same problem:

big_int = int(sys.float_info.max) * 2 struct.pack('d', big_int) Traceback (most recent call last): File "", line 1, in struct.error: required argument is not a float

but the 'array' module does the right thing:

big_int = int(sys.float_info.max) * 2 [68068 refs] array.array('d', [big_int]) Traceback (most recent call last): File "", line 1, in OverflowError: long int too large to convert to float [68068 refs] array.array('d', [""]) Traceback (most recent call last): File "", line 1, in TypeError: a float is required

Mark, do you have any opinions on the error handling here and in the struct module?