diff options
author | Raymond Hettinger <python@rcn.com> | 2003-08-30 14:43:55 +0000 |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-08-30 14:43:55 +0000 |
commit | c11dbcd4bfb6c366e9ce541b982a036b34f7c30c (patch) | |
tree | 1ff7b900d7de13d81b1c46b0ba8c3c882184d679 /Lib/textwrap.py | |
parent | 62297132215490e9cb406e1a21f03aff40d421cb (diff) | |
download | cpython-git-c11dbcd4bfb6c366e9ce541b982a036b34f7c30c.tar.gz |
SF bug 797650: Infinite loop in textwrap.py
When the indents were set to longer than the width and long word breaking
was enabled, an infinite loop would result because the inner loop did not
assure that at least one character was stripped off on every pass.
Diffstat (limited to 'Lib/textwrap.py')
-rw-r--r-- | Lib/textwrap.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/textwrap.py b/Lib/textwrap.py index a4a549848f..f371fbbe5a 100644 --- a/Lib/textwrap.py +++ b/Lib/textwrap.py @@ -168,7 +168,7 @@ class TextWrapper: Handle a chunk of text (most likely a word, not whitespace) that is too long to fit in any line. """ - space_left = width - cur_len + space_left = max(width - cur_len, 1) # If we're allowed to break long words, then do so: put as much # of the next chunk onto the current line as will fit. |