Fixed #7392 (matchcompiler fails with python 3.5)

This commit is contained in:
Frank Zingsheim 2016-05-04 11:19:07 +02:00 committed by PKEuS
parent b7d8cd69f6
commit f5bf0ff824
1 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import io
import os import os
import sys import sys
import re import re
@ -604,7 +605,7 @@ class MatchCompiler:
def convertFile(self, srcname, destname, line_directive): def convertFile(self, srcname, destname, line_directive):
self._reset() self._reset()
fin = open(srcname, "rt") fin = io.open(srcname, "rt", encoding="us-ascii")
srclines = fin.readlines() srclines = fin.readlines()
fin.close() fin.close()
@ -637,7 +638,7 @@ class MatchCompiler:
if line_directive: if line_directive:
lineno = '#line 1 "' + srcname + '"\n' lineno = '#line 1 "' + srcname + '"\n'
fout = open(destname, 'wt') fout = io.open(destname, 'wt', encoding="us-ascii")
fout.write(header + strFunctions + lineno + code) fout.write(header + strFunctions + lineno + code)
fout.close() fout.close()