]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix reindent-rst.py: it works on binary files
authorVictor Stinner <victor.stinner@haypocalc.com>
Wed, 18 Aug 2010 21:59:12 +0000 (21:59 +0000)
committerVictor Stinner <victor.stinner@haypocalc.com>
Wed, 18 Aug 2010 21:59:12 +0000 (21:59 +0000)
Tools/scripts/reindent-rst.py

index 55b99ebabad8c93ded8507e2bfa87e337371e186..a19406f5e57bdcc3547bc27efc01b5c23ef8c883 100755 (executable)
@@ -6,7 +6,7 @@
 
 import sys, re, shutil
 
-ws_re = re.compile(r'\s+(\r?\n)$')
+ws_re = re.compile(br'\s+(\r?\n)$')
 
 def main(argv=sys.argv):
     rv = 0
@@ -14,7 +14,7 @@ def main(argv=sys.argv):
         try:
             with open(filename, 'rb') as f:
                 lines = f.readlines()
-            new_lines = [ws_re.sub(r'\1', line) for line in lines]
+            new_lines = [ws_re.sub(br'\1', line) for line in lines]
             if new_lines != lines:
                 print('Fixing %s...' % filename)
             shutil.copyfile(filename, filename + '.bak')