bpo-33954: Fix _PyUnicode_InsertThousandsGrouping() by vstinner · Pull Request #10623 · python/cpython

@vstinner

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
  for digits.
* FILL() macro now also checks "0 <= start".

@vstinner

* Convert FILL() macro to static inline function
* Rename the function to unicode_fill().
* Replace "i" iterator with end pointer for the end condition.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request

Nov 26, 2018
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>

vstinner added a commit that referenced this pull request

Nov 26, 2018
)

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

Rewrite _PyUnicode_InsertThousandsGrouping(): it now requires
a _PyUnicodeWriter object for the buffer and a Python str object
for digits.

(cherry picked from commit 59423e3)

vstinner added a commit that referenced this pull request

Nov 26, 2018
) (GH-10720)

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

Rewrite _PyUnicode_InsertThousandsGrouping(): it now requires
a _PyUnicodeWriter object for the buffer and a Python str object
for digits.

(cherry picked from commit 59423e3)
(cherry picked from commit 6f5fa1b)