[issue10557] Malformed error message from float()

Marc-Andre Lemburg report at bugs.python.org
Sun Nov 28 19:01:47 CET 2010


Marc-Andre Lemburg <mal at egenix.com> added the comment:

Mark Dickinson wrote:
> 
> Mark Dickinson <dickinsm at gmail.com> added the comment:
> 
> About Alexander's solution:  might it make more sense to have PyUnicode_EncodeDecimal raise for inputs like this?  I see it as PyUnicode_EncodeDecimal's job to turn the unicode input into usable ASCII (or raise an exception);  it looks like that's not happening here.
> 
> Adding MAL to the nosy in case he wants to comment on this.

The purpose of the PyUnicode_EncodeDecimal() API is to convert
Unicode decimal digits to ASCII digits for interpretation by
the other usual functions to convert the ASCII representation to
numbers.

The proposed patch will not work, since it removes the support for
non-ASCII number code points, e.g. Asian number code points.

You might want to replace the error message by something more
related to floats in the float constructor. Note that UnicodeErrors
are subclasses of ValueErrors, so the errors are not unexpected
for number constructors.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10557>
_______________________________________


More information about the Python-bugs-list mailing list