[issue25543] locale.atof keep '.' even if not part of the localeconv

Cédric Krier report at bugs.python.org
Tue Nov 3 08:51:34 EST 2015


Cédric Krier added the comment:

But you can have some strange behaviour:

>>> import locale
>>> locale.setlocale(locale.LC_ALL, 'fr_FR.UTF-8')
'fr_FR.UTF-8'
>>> locale.atof('2.500,5')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python2.7/locale.py", line 316, in atof
    return func(string)
ValueError: invalid literal for float(): 2.500.5
>>> locale.atof('2.500')
2.5

If you agree to make it more strict, I can work on a patch, otherwise I will just add some tests on my code.

----------

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


More information about the Python-bugs-list mailing list