Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:

Looking into the code min_width is returned as -2 and hence the assert fails. 
spec->n_min_width is passed as min_width to _PyUnicode_InsertThousandsGrouping 
that is used in the assert statement and I came across below comment that 
min_width can go negative and it's okay. So is the assert statement validating 
for it to be always greater than or equal to zero not needed?

https://github.com/python/cpython/blob/59423e3ddd736387cef8f7632c71954c1859bed0/Python/formatter_unicode.c#L529

    /* min_width can go negative, that's okay. format->width == -1 means
       we don't care. */
    if (format->fill_char == '0' && format->align == '=')
        spec->n_min_width = format->width - n_non_digit_non_padding;
    else
        spec->n_min_width = 0;

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35560>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to