New submission from Mark Dickinson <[email protected]>:
Two problems with float.fromhex:
(1) it incorrectly rejects trailing whitespace on infs and nans:
>>> float.fromhex('a.0 ')
10.0
>>> float.fromhex('nan ')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: invalid hexadecimal floating-point string
(2) The implementation uses PyOS_strnicmp for detecting nans and infs,
which is locale-aware. A locale-unaware case-insensitive comparison
should be used instead. I don't know of any locale where this actually
makes a difference, but I think it should be fixed anyway.
----------
assignee: marketdickinson
components: Interpreter Core
messages: 87509
nosy: marketdickinson
priority: normal
severity: normal
stage: needs patch
status: open
title: float.fromhex bugs
type: behavior
versions: Python 2.6, Python 2.7, Python 3.0, Python 3.1
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue5981>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com