Commits

Joe Amenta committed cafb4bb

Fixing a bug in fix_bytes that was causing crashes under unknown circumstances

Comments (0)

Files changed (1)

lib3to2/fixes/fix_bytes.py

         return results
 
     def transform(self, node, results):
-        new = node.clone()
         name = results.get("name")
         arglist = results.get("args")
         if name is not None:
             assert name.value == "bytes"
-            name.replace(Name("str", prefix=name.prefix))
+            name.value = "str"
+            name.changed()
         elif node.type == token.STRING:
             if _literal_re.match(node.value):
+                new = node.clone()
                 new.value = new.value[1:]
                 return new
         if arglist is not None: