Commit 742b6566 authored by Bryton Lacquement's avatar Bryton Lacquement 🚪

fix_{traced,}division: modify trace format

':' is too common; it can be used in the filename.
parent 1d87f427
...@@ -9,7 +9,7 @@ import re ...@@ -9,7 +9,7 @@ import re
from my2to3.util import add_future from my2to3.util import add_future
trace_file_match = re.compile(r"^(.*):(.*):(.*) <type '(.*)'> / <type '(.*)'>$").match trace_file_match = re.compile(r"^(.*)\|(.*)\|(.*) <type '(.*)'> / <type '(.*)'>$").match
def parse_trace_data(filepath): def parse_trace_data(filepath):
...@@ -70,7 +70,6 @@ class FixDivision(lib2to3.fixer_base.BaseFix): ...@@ -70,7 +70,6 @@ class FixDivision(lib2to3.fixer_base.BaseFix):
def transform(self, node, results): def transform(self, node, results):
lineno = node.get_lineno() lineno = node.get_lineno()
id_ = int(node.children[1].children[1].children[0].value) id_ = int(node.children[1].children[1].children[0].value)
data = self.traces[self.absolute_filename][lineno][id_] data = self.traces[self.absolute_filename][lineno][id_]
if not data: if not data:
return return
......
...@@ -16,7 +16,7 @@ class FixTraceDivision(lib2to3.fixer_base.BaseFix): ...@@ -16,7 +16,7 @@ class FixTraceDivision(lib2to3.fixer_base.BaseFix):
def division_traced(id, dividend, divisor): def division_traced(id, dividend, divisor):
import inspect import inspect
previous_frame = inspect.currentframe().f_back previous_frame = inspect.currentframe().f_back
print ("{}:{}:{} {} / {}".format( print ("{}|{}|{} {} / {}".format(
previous_frame.f_code.co_filename, previous_frame.f_code.co_filename,
previous_frame.f_lineno, previous_frame.f_lineno,
id, id,
......
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