STINNER Victor <victor.stin...@haypocalc.com> added the comment: With the changeset 056f5cc8885d, format(1234, 'n') fails in a locale using a non-ASCII thousands separator. Patch showing the problem:
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py --- a/Lib/test/test_format.py +++ b/Lib/test/test_format.py @@ -1,4 +1,5 @@ from test.support import verbose, TestFailed +import locale import sys import test.support as support import unittest @@ -282,6 +283,19 @@ class FormatTest(unittest.TestCase): self.assertEqual(format(1+2j, "\u2007^8"), "\u2007(1+2j)\u2007") self.assertEqual(format(0j, "\u2007^4"), "\u20070j\u2007") + def test_locale(self): + try: + oldloc = locale.setlocale(locale.LC_ALL, '') + except locale.Error as err: + self.skipTest("Cannot set locale: {}".format(err)) + try: + sep = locale.localeconv()['thousands_sep'] + self.assertEqual(format(123456789, "n"), + sep.join(('123', '456', '789'))) + finally: + locale.setlocale(locale.LC_ALL, oldloc) + + def test_main(): support.run_unittest(FormatTest) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13706> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com