[Python-checkins] python/dist/src/Lib/test test_textwrap.py, 1.22, 1.23

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Sat Aug 30 08:43:57 EDT 2003


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv20357/test

Modified Files:
	test_textwrap.py 
Log Message:
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.



Index: test_textwrap.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_textwrap.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** test_textwrap.py	8 May 2003 01:58:26 -0000	1.22
--- test_textwrap.py	30 Aug 2003 14:43:55 -0000	1.23
***************
*** 306,309 ****
--- 306,319 ----
                           'How *do* you spell that odd word, anyways?'])
  
+         # SF bug 797650.  Prevent an infinite loop by making sure that at
+         # least one character gets split off on every pass.
+         self.check_wrap('-'*10+'hello', 10,
+                         ['----------',
+                          '               h',
+                          '               e',
+                          '               l',
+                          '               l',
+                          '               o'],
+                         subsequent_indent = ' '*15)
  
      def test_nobreak_long(self):





More information about the Python-checkins mailing list