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

> min_width сan be large negative number, and there are subtractions from it. 
> It may be safer to replace the assert with something like min_width = 
> Py_MAX(0, min_width). Or ensure that it is non-negative before calling 
> _PyUnicode_InsertThousandsGrouping()

Looking at the code the loop seems to operate on the assumption that min_width 
is >= 0 in the beginning with the assert statement until both remaining and 
min_width are negative to break out of the loop. Applying Py_MAX(0, min_width) 
causes no test failures but maybe I have missed adding a case where large 
negative min_width might have triggered other issue.

----------

_______________________________________
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