[Python-checkins] r57942 - sandbox/trunk/2to3/refactor.py

collin.winter python-checkins at python.org
Tue Sep 4 05:17:28 CEST 2007


Author: collin.winter
Date: Tue Sep  4 05:17:27 2007
New Revision: 57942

Modified:
   sandbox/trunk/2to3/refactor.py
Log:
Silence certain parse errors (as reported by the twisted folks).

Modified: sandbox/trunk/2to3/refactor.py
==============================================================================
--- sandbox/trunk/2to3/refactor.py	(original)
+++ sandbox/trunk/2to3/refactor.py	Tue Sep  4 05:17:27 2007
@@ -212,7 +212,7 @@
             self.log_error("Can't open %s: %s", filename, err)
             return
         try:
-            input = f.read()
+            input = f.read() + "\n" # Silence certain parse errors
         finally:
             f.close()
         if self.options.doctests_only:
@@ -226,7 +226,8 @@
         else:
             tree = self.refactor_string(input, filename)
             if tree and tree.was_changed:
-                self.write_file(str(tree), filename)
+                # The [:-1] is to take off the \n we added earlier
+                self.write_file(str(tree)[:-1], filename)
             elif self.options.verbose:
                 self.log_message("No changes in %s", filename)
 


More information about the Python-checkins mailing list