Meador Inge <mead...@gmail.com> added the comment:

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 "<stdin>", line 1, in <module>
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 "<stdin>", line 1, in <module>
OverflowError: long int too large to convert to float
[68068 refs]
>>> array.array('d', [""])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: a float is required

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

----------
nosy: +mark.dickinson
versions: +Python 2.7, Python 3.2
Added file: http://bugs.python.org/file24518/issue9041-v0.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9041>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to