summaryrefslogtreecommitdiffstatshomepage
path: root/py/mpz.c
diff options
context:
space:
mode:
authorAlessandro Gatti <a.gatti@frob.it>2024-09-23 18:07:47 +0200
committerDamien George <damien@micropython.org>2024-09-26 23:39:06 +1000
commit43b05afdf51d19caadafd27562dafc4a85f0b67d (patch)
tree8fffb943deaeb3a6ff89c750757e4666218824ab /py/mpz.c
parentb0ba151102a6c1b2e0e4c419c6482a64677c9b40 (diff)
downloadmicropython-43b05afdf51d19caadafd27562dafc4a85f0b67d.tar.gz
micropython-43b05afdf51d19caadafd27562dafc4a85f0b67d.zip
py/mpz: Skip separators when running out of digits to print.
This commit fixes the addition of a stray separator before the number when printing an MPZ-backed integer and the first group is three digits long. This fixes #8984. Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
Diffstat (limited to 'py/mpz.c')
-rw-r--r--py/mpz.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/py/mpz.c b/py/mpz.c
index 750664ad9a..084aebda9e 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -1717,7 +1717,7 @@ size_t mpz_as_str_inpl(const mpz_t *i, unsigned int base, const char *prefix, ch
break;
}
}
- if (comma && (s - last_comma) == 3) {
+ if (!done && comma && (s - last_comma) == 3) {
*s++ = comma;
last_comma = s;
}