@@ -529,6 +529,9 @@ calc_number_widths(NumberFieldWidths *spec, Py_ssize_t n_prefix,
529529 if (spec -> n_lpadding || spec -> n_spadding || spec -> n_rpadding )
530530 * maxchar = Py_MAX (* maxchar , format -> fill_char );
531531
532+ if (spec -> n_decimal )
533+ * maxchar = Py_MAX (* maxchar , PyUnicode_MAX_CHAR_VALUE (locale -> decimal_point ));
534+
532535 return spec -> n_lpadding + spec -> n_sign + spec -> n_prefix +
533536 spec -> n_spadding + spec -> n_grouped_digits + spec -> n_decimal +
534537 spec -> n_remainder + spec -> n_rpadding ;
@@ -548,10 +551,7 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec,
548551 Py_ssize_t d_pos = d_start ;
549552 unsigned int kind = PyUnicode_KIND (out );
550553 void * data = PyUnicode_DATA (out );
551-
552- #ifndef NDEBUG
553554 Py_ssize_t r ;
554- #endif
555555
556556 if (spec -> n_lpadding ) {
557557 PyUnicode_Fill (out , pos , pos + spec -> n_lpadding , fill_char );
@@ -593,18 +593,15 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec,
593593 if (pdigits == NULL )
594594 return -1 ;
595595 }
596- #ifndef NDEBUG
597- r =
598- #endif
599- _PyUnicode_InsertThousandsGrouping (
596+ r = _PyUnicode_InsertThousandsGrouping (
600597 out , pos ,
601598 spec -> n_grouped_digits ,
602599 pdigits + kind * d_pos ,
603600 spec -> n_digits , spec -> n_min_width ,
604601 locale -> grouping , locale -> thousands_sep , NULL );
605- #ifndef NDEBUG
602+ if (r == -1 )
603+ return -1 ;
606604 assert (r == spec -> n_grouped_digits );
607- #endif
608605 if (PyUnicode_KIND (digits ) < kind )
609606 PyMem_Free (pdigits );
610607 d_pos += spec -> n_digits ;
0 commit comments