Commits

Anonymous committed b21925b

Fixed bug in absimport that crashed parser

  • Participants
  • Parent commits 21d4d70

Comments (0)

Files changed (1)

File lib3to2/fixes/fix_absimport.py

 
 class FixAbsimport(fixer_base.BaseFix):
     order = 'post'
+    run_order = 10 
     
     def __init__(self, options, log):
         super(FixAbsimport, self).__init__(options, log)
                 and not self.__abs_added)
     
     def transform(self, node, results):
-        future_import('absolute_import', node)
-        self.__abs_added = True
+        try:
+            future_import('absolute_import', node)
+        except ValueError:
+            pass
+        else:
+            self.__abs_added = True
         
     def finish_tree(self, tree, filename):
         fixer_base.BaseFix.finish_tree(self, tree, filename)