STINNER Victor <vstin...@redhat.com> added the comment:
Aha, the problem occurs when the thousands separator code point is greater than 255. On my Fedora 28 (glibc 2.27), it's U+202f: vstinner@apu$ ./python Python 3.8.0a0 (heads/master-dirty:492572715a, Jun 28 2018, 00:18:54) >>> import locale >>> locale.setlocale(locale.LC_ALL, '') 'fr_FR.UTF-8' >>> locale.localeconv()['thousands_sep'] '\u202f' The bug is in _PyUnicode_InsertThousandsGrouping(): if thousands_sep kind is different than unicode kind, "data = _PyUnicode_AsKind(unicode, thousands_sep_kind);" is used, but later this memory is released. So the function writes into a temporary buffer which is then released. It doesn't work... It seems like I introduced the regression 6 years ago in bpo-13706: commit 90f50d4df9e21093f006427fd7ed11a0d704f792 Author: Victor Stinner <victor.stin...@haypocalc.com> Date: Fri Feb 24 01:44:47 2012 +0100 Issue #13706: Fix format(float, "n") for locale with non-ASCII decimal point (e.g. ps_aF) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33954> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com