Commit a2ab7763 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

trace_division: fix comma prefix

This way, the ',' behaves like the old '/'. This change is introduced to
support division on multiple lines.
parent 8ab2c9bf
...@@ -38,6 +38,9 @@ class FixTraceDivision(lib2to3.fixer_base.BaseFix): ...@@ -38,6 +38,9 @@ class FixTraceDivision(lib2to3.fixer_base.BaseFix):
def transform(self, node, results): def transform(self, node, results):
lineno = node.get_lineno() lineno = node.get_lineno()
comma = lib2to3.fixer_util.Comma()
comma.prefix = prefix=node.children[1].prefix
node.replace( node.replace(
lib2to3.fixer_util.Call( lib2to3.fixer_util.Call(
lib2to3.fixer_util.Name("division_traced"), lib2to3.fixer_util.Name("division_traced"),
...@@ -45,7 +48,7 @@ class FixTraceDivision(lib2to3.fixer_base.BaseFix): ...@@ -45,7 +48,7 @@ class FixTraceDivision(lib2to3.fixer_base.BaseFix):
lib2to3.fixer_util.Number(self.ids[lineno]), lib2to3.fixer_util.Number(self.ids[lineno]),
lib2to3.fixer_util.Comma(), lib2to3.fixer_util.Comma(),
node.children[0].clone(), node.children[0].clone(),
lib2to3.fixer_util.Comma(), comma,
node.children[2].clone(), node.children[2].clone(),
), ),
prefix=node.prefix)) prefix=node.prefix))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment