aboutsummaryrefslogtreecommitdiff
path: root/share/opt-viewer/optrecord.py
diff options
context:
space:
mode:
Diffstat (limited to 'share/opt-viewer/optrecord.py')
-rwxr-xr-xshare/opt-viewer/optrecord.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/share/opt-viewer/optrecord.py b/share/opt-viewer/optrecord.py
index f6fd772..6a53e13 100755
--- a/share/opt-viewer/optrecord.py
+++ b/share/opt-viewer/optrecord.py
@@ -2,6 +2,7 @@
from __future__ import print_function
+import io
import yaml
# Try to use the C parser.
try:
@@ -10,7 +11,7 @@ except ImportError:
print("For faster parsing, you may want to install libYAML for PyYAML")
from yaml import Loader
-import cgi
+import html
from collections import defaultdict
import fnmatch
import functools
@@ -158,7 +159,7 @@ class Remark(yaml.YAMLObject):
(key, value) = list(mapping.items())[0]
if key == 'Caller' or key == 'Callee' or key == 'DirectCallee':
- value = cgi.escape(self.demangle(value))
+ value = html.escape(self.demangle(value))
if dl and key != 'Caller':
dl_dict = dict(list(dl))
@@ -272,7 +273,7 @@ def get_remarks(input_file, filter_=None):
all_remarks = dict()
file_remarks = defaultdict(functools.partial(defaultdict, list))
- with open(input_file) as f:
+ with io.open(input_file, encoding = 'utf-8') as f:
docs = yaml.load_all(f, Loader=Loader)
filter_e = None