You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Wrong sign placement in PyUnicode_FromFormat #95504
When specifying width or precision with a negative number the sign ignores that and sticks to the number.
Width specifies the minimum output width, so if the zero flag is set the sign should be the first character of the width padding, if the zero flag is not set the last character of the padding.
Precision specifies the number of digits, so the sign should be placed before precision count digits.
PyUnicode_FromFormat( "%05d", -123); // "0-123" should be "-0123"PyUnicode_FromFormat( "%.5d", -123); // "0-123" should be "-00123"PyUnicode_FromFormat( "%7.5d", -123); // " 0-123" should be " -00123"PyUnicode_FromFormat("%07.5d", -123); // "000-123" should be "-000123"
Activity
gh-95504: Fix negative numbers in PyUnicode_FromFormat (GH-95848)
kumaraditya303 commentedon Sep 4, 2022
Fixed by #95848