Skip to content

bpo-27772: Make preciding width with 0 valid in string format.#11270

Merged
serhiy-storchaka merged 4 commits into
python:masterfrom
serhiy-storchaka:format-str-default-align
Jan 25, 2021
Merged

bpo-27772: Make preciding width with 0 valid in string format.#11270
serhiy-storchaka merged 4 commits into
python:masterfrom
serhiy-storchaka:format-str-default-align

Conversation

@serhiy-storchaka
Copy link
Copy Markdown
Member

@serhiy-storchaka serhiy-storchaka commented Dec 20, 2018

Previously it was an error with confusing error message.

https://bugs.python.org/issue27772

Previously it was an error with confusing error message.
Comment thread Doc/library/string.rst Outdated
@serhiy-storchaka serhiy-storchaka merged commit cf19cc3 into python:master Jan 25, 2021
@serhiy-storchaka serhiy-storchaka deleted the format-str-default-align branch January 25, 2021 09:56
adorilson pushed a commit to adorilson/cpython that referenced this pull request Mar 13, 2021
…nGH-11270)

Previously it was an error with confusing error message.
osandov added a commit to osandov/drgn that referenced this pull request Oct 15, 2025
…Python < 3.10

Before Python 3.10 (python/cpython#11270),
formatting a string with a width of 0 fails:

    >>> f"{'foo':0}"
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ValueError: '=' alignment not allowed in string format specifier

print_table() fails with this error if a column containing strings has
width 0. Work around this for older Python versions.

Signed-off-by: Omar Sandoval <osandov@osandov.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants