
report at bugs
May 5, 2012, 1:25 PM
Post #12 of 15
(80 views)
Permalink
|
|
[issue14722] Overflow in parsing 'float' parameters in PyArg_ParseTuple*
[In reply to]
|
|
Stefan Krah <stefan-usenet [at] bytereef> added the comment: The proposal makes sense at first glance, but I agree with Mark that it is not clear what should be done. For example, all arrays in Python silently convert to inf: >>> from numpy import array >>> x = array([1,2,3], 'f') >>> x array([ 1., 2., 3.], dtype=float32) >>> x[0] = 10**100 >>> x array([ inf, 2., 3.], dtype=float32) Same for array.array and memoryview. I would not be surprised if users rely on this behavior. Anyway, silently converting to infinity is exactly what I'd expect (also for double BTW). Regarding undefined behavior: I only know compilers that convert to infinity without signaling overflow. The tests for the new memoryview implementation should include this case (I think!), and I ran the tests with all compilers that I've access to. ---------- _______________________________________ Python tracker <report [at] bugs> <http://bugs.python.org/issue14722> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
|