[3.7] bpo-33954: Fix _PyUnicode_InsertThousandsGrouping() (GH-10623) by miss-islington · Pull Request #10717 · python/cpython

@vstinner @miss-islington

Fix str.format(), float.__format__() and complex.__format__() methods
for non-ASCII decimal point when using the "n" formatter.

Changes:

* Rewrite _PyUnicode_InsertThousandsGrouping(): it now requires
  a _PyUnicodeWriter object for the buffer and a Python str object
  for digits.
* Rename FILL() macro to unicode_fill(), convert it to static inline function,
  add "assert(0 <= start);" and rework its code.
(cherry picked from commit 59423e3)

Co-authored-by: Victor Stinner <vstinner@redhat.com>