From b724befdb6e61f97b44d04b9d55bc690aee5069f Mon Sep 17 00:00:00 2001 From: Wu Xiaotian Date: Mon, 22 Jun 2020 00:01:07 +0000 Subject: tools: update to use python3 --- tools/preprocessor.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tools/preprocessor.py') diff --git a/tools/preprocessor.py b/tools/preprocessor.py index f78647bf..4292af02 100644 --- a/tools/preprocessor.py +++ b/tools/preprocessor.py @@ -23,6 +23,7 @@ import sys import re +import io class DeepnessException(Exception): def __init__(self): @@ -64,13 +65,13 @@ def _subvar(match, macros): return val def process(infile = sys.stdin, outfile = sys.stdout, macros = {}): - if not isinstance(infile, file): + if not isinstance(infile, io.IOBase): infile = open(infile, mode = 'r') close_infile = True else: close_infile = False - if not isinstance(outfile, file): + if not isinstance(outfile, io.IOBase): outfile = open(outfile, mode = 'w') close_outfile = True else: -- cgit v1.2.1