Commit ad0bf38e authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

More python3 updates

parent 59698041
......@@ -95,11 +95,11 @@ def parse_asn1(*files, **options):
file_list = sorted(list(*files))
try:
for each in file_list:
filehash.update(open(each).read())
filehash.update(open(each).read().encode('utf-8'))
# also hash the file path: it is used in the AST, so it is
# not enough to hash the content of the ASN.1 files, as two sets
# of input files may have the same hash
filehash.update(each)
filehash.update(each.encode('utf-8'))
except IOError as err:
raise TypeError (str(err))
new_hash = filehash.hexdigest()
......
......@@ -5325,7 +5325,8 @@ def parser_init(filename=None, string=None):
''' Initialize the parser (to be called first) '''
if filename is not None:
try:
char_stream = antlr3.ANTLRFileStream(filename, encoding='utf-8')
# encoding not available in python3 runtime, seems to default ok
char_stream = antlr3.ANTLRFileStream(filename) #, encoding='utf-8')
except (IOError, TypeError) as err:
LOG.debug(str(traceback.format_exc()))
raise
......
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