Skip to content

textwrap can leave a trailing space before long word #139065

Closed

Description

@serhiy-storchaka

Bug report

>>> textwrap.wrap('Did you say "supercalifragilisticexpialidocious?" How *do* you spell that odd word, anyways?', 12)
['Did you say ', '"supercalifr', 'agilisticexp', 'ialidocious?', '" How *do*', 'you spell', 'that odd', 'word,', 'anyways?']

Note a trailing space in the first line. No trailing spaces in other lines.

This is even in the tests, but I do not think it is an intentional behavior. The bug was introduced in the fix for:

Linked PRs

Activity

  1. added
    type-bug
    3.13
    3.14
    3.15
    on Sep 17, 2025
  2. added
    stdlib
    on Sep 17, 2025
  3. added 2 commits that reference this issue on Sep 17, 2025
  4. added a commit that references this issue on Oct 10, 2025
  5. added 2 commits that reference this issue on Oct 10, 2025
  6. added 2 commits that reference this issue on Oct 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

3.133.143.15stdlibtype-bug

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions