-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
Argparse wrapping is bugged when colors are involved #142035
Copy link
Copy link
Open
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15new features, bugs and security fixesnew features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
Status
Bugs
Bug report
Bug description:
While working on coloring interpolated values in #141940, I realized that in some cases the wrapping is broken.
For example in this case, just a color change around the commas makes the wrapping different, because
textwrap.wrapis sensitive to ANSI escape codes (those change the string length).There are 2 ways to fix this:
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs