gh-130664: Treat '0' fill character with align '=' as zero-padding for Fraction's (GH-131067)

This commit is contained in:
Sergey B Kirpichev 2025-07-03 13:57:31 +03:00 committed by GitHub
parent 5c984ae35e
commit c113a8e523
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 9 additions and 5 deletions

View file

@ -504,6 +504,9 @@ class Fraction(numbers.Rational):
trim_point = not alternate_form
exponent_indicator = "E" if presentation_type in "EFG" else "e"
if align == '=' and fill == '0':
zeropad = True
# Round to get the digits we need, figure out where to place the point,
# and decide whether to use scientific notation. 'point_pos' is the
# relative to the _end_ of the digit string: that is, it's the number