[issue32397] textwrap output may change if you wrap a paragraph twice

Larry Hastings report at bugs.python.org
Thu Dec 21 09:10:43 EST 2017


New submission from Larry Hastings <larry at hastings.org>:

If you word-wrap a paragraph twice with textwrap, you may get different results.  Specifically, you *will* get different results when:
* the original text has a line that is too long by one character,
* the last word on the line is the first word in a new sentence, and
* there are two spaces after the period.

The first textwrap will replace the two spaces after the period with a newline; the second textwrap will replace the newline with a single space.

Attached is a test case demonstrating the problem.

It's not a big problem, but it did cause an assertion failure in blurb.  The workaround was to word-wrap all paragraphs twice, which works but is kind of dumb.

----------
components: Library (Lib)
files: textwrap.isnt.stable.py
messages: 308872
nosy: larry
priority: low
severity: normal
status: open
title: textwrap output may change if you wrap a paragraph twice
versions: Python 3.7
Added file: https://bugs.python.org/file47344/textwrap.isnt.stable.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32397>
_______________________________________


More information about the Python-bugs-list mailing list