From f5bf0ff824d4db5eaa8b6d9a4d56e776655694bb Mon Sep 17 00:00:00 2001 From: Frank Zingsheim Date: Wed, 4 May 2016 11:19:07 +0200 Subject: [PATCH] Fixed #7392 (matchcompiler fails with python 3.5) --- tools/matchcompiler.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tools/matchcompiler.py b/tools/matchcompiler.py index 2104d8903..08c4699d9 100755 --- a/tools/matchcompiler.py +++ b/tools/matchcompiler.py @@ -16,6 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import io import os import sys import re @@ -158,7 +159,7 @@ class MatchCompiler: ret += ' if (!tok || tok->str().size()!=1U || !strchr("' + tok[1:-1] + '", tok->str()[0]))\n' ret += ' ' + returnStatement - # a|b|c + # a|b|c elif tok.find('|') > 0: tokens2 = tok.split('|') logicalOp = None @@ -604,7 +605,7 @@ class MatchCompiler: def convertFile(self, srcname, destname, line_directive): self._reset() - fin = open(srcname, "rt") + fin = io.open(srcname, "rt", encoding="us-ascii") srclines = fin.readlines() fin.close() @@ -637,7 +638,7 @@ class MatchCompiler: if line_directive: lineno = '#line 1 "' + srcname + '"\n' - fout = open(destname, 'wt') + fout = io.open(destname, 'wt', encoding="us-ascii") fout.write(header + strFunctions + lineno + code) fout.close()