[Python-checkins] r62500 - in python/trunk: Lib/test/test_textwrap.py Lib/textwrap.py Misc/NEWS

mark.dickinson python-checkins at python.org
Fri Apr 25 18:59:09 CEST 2008


Author: mark.dickinson
Date: Fri Apr 25 18:59:09 2008
New Revision: 62500

Log:
Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill.



Modified:
   python/trunk/Lib/test/test_textwrap.py
   python/trunk/Lib/textwrap.py
   python/trunk/Misc/NEWS

Modified: python/trunk/Lib/test/test_textwrap.py
==============================================================================
--- python/trunk/Lib/test/test_textwrap.py	(original)
+++ python/trunk/Lib/test/test_textwrap.py	Fri Apr 25 18:59:09 2008
@@ -129,6 +129,10 @@
         expect = ['And she said, "Go to hell!"  Can you believe that?']
         self.check(wrapper.wrap(text), expect)
 
+        text = 'File stdio.h is nice.'
+        expect = ['File stdio.h is nice.']
+        self.check(wrapper.wrap(text), expect)
+
     def test_wrap_short(self):
         # Wrapping to make short lines longer
 

Modified: python/trunk/Lib/textwrap.py
==============================================================================
--- python/trunk/Lib/textwrap.py	(original)
+++ python/trunk/Lib/textwrap.py	Fri Apr 25 18:59:09 2008
@@ -90,6 +90,7 @@
     sentence_end_re = re.compile(r'[%s]'              # lowercase letter
                                  r'[\.\!\?]'          # sentence-ending punct.
                                  r'[\"\']?'           # optional end-of-quote
+                                 r'\Z'                # end of chunk
                                  % string.lowercase)
 
 

Modified: python/trunk/Misc/NEWS
==============================================================================
--- python/trunk/Misc/NEWS	(original)
+++ python/trunk/Misc/NEWS	Fri Apr 25 18:59:09 2008
@@ -43,6 +43,10 @@
 Library
 -------
 
+- Issue #2635: Fix bug in 'fix_sentence_endings' textwrap.fill option,
+  where an extra space was added after a word containing (but not
+  ending in) '.', '!' or '?'.
+
 - Add from_buffer() and from_buffer_copy() class methods to ctypes
   data types
 


More information about the Python-checkins mailing list