Alexander Belopolsky <belopol...@users.sourceforge.net> added the comment:
On Sun, Nov 28, 2010 at 12:00 PM, Mark Dickinson <rep...@bugs.python.org> wrote: > > Mark Dickinson <dicki...@gmail.com> added the comment: > > About Alexander's solution: might it make more sense to have > PyUnicode_EncodeDecimal raise > for inputs like this? No, I think PyOS_string_to_double() can generate better error messages than PyUnicode_EncodeDecimal. It is important to pass losslessly encoded string to PyOS_string_to_double() for proper error reporting. Otherwise, we will have to catch the error in PyFloat_FromString() just to add the string value to the message and may loose other information such as the precise location of the offending character. (AFAICT, we don't make use of it now, but this would be a meaningful improvement.) > 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. UTF-8 is quite usable by PyOS_string_to_double() . UTF-8 encoder is extremely fast and will only get faster over time. In my opinion, PyUnicode_EncodeDecimal() is either unnecessary or should be exposed as a codec. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue10557> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com