[llvm] 4b428e8 - Convert old python3 cgi method into the new html one

Sylvestre Ledru via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 25 14:39:28 PDT 2020


Author: Gianfranco Costamagna
Date: 2020-03-25T22:38:55+01:00
New Revision: 4b428e8f18c7006f69b3d4ef0fdf091d998d0941

URL: https://github.com/llvm/llvm-project/commit/4b428e8f18c7006f69b3d4ef0fdf091d998d0941
DIFF: https://github.com/llvm/llvm-project/commit/4b428e8f18c7006f69b3d4ef0fdf091d998d0941.diff

LOG: Convert old python3 cgi method into the new html one

Summary: Patch by Gianfranco Costamagna

Reviewers: serge-sans-paille

Reviewed By: serge-sans-paille

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D76126

Added: 
    

Modified: 
    llvm/tools/opt-viewer/opt-viewer.py
    llvm/tools/opt-viewer/optrecord.py

Removed: 
    


################################################################################
diff  --git a/llvm/tools/opt-viewer/opt-viewer.py b/llvm/tools/opt-viewer/opt-viewer.py
index e98781595acc..714fccc8df96 100755
--- a/llvm/tools/opt-viewer/opt-viewer.py
+++ b/llvm/tools/opt-viewer/opt-viewer.py
@@ -3,9 +3,9 @@
 from __future__ import print_function
 
 import argparse
-import cgi
 import errno
 import functools
+import html
 import io
 from multiprocessing import cpu_count
 import os.path
@@ -197,7 +197,7 @@ def __init__(self, output_dir, should_display_hotness, max_hottest_remarks_on_in
         self.max_hottest_remarks_on_index = max_hottest_remarks_on_index
 
     def render_entry(self, r, odd):
-        escaped_name = cgi.escape(r.DemangledFunctionName)
+        escaped_name = html.escape(r.DemangledFunctionName)
         print(u'''
 <tr>
 <td class=\"column-entry-{odd}\"><a href={r.Link}>{r.DebugLocString}</a></td>

diff  --git a/llvm/tools/opt-viewer/optrecord.py b/llvm/tools/opt-viewer/optrecord.py
index 2dff0c847c77..6a53e13f4c2b 100644
--- a/llvm/tools/opt-viewer/optrecord.py
+++ b/llvm/tools/opt-viewer/optrecord.py
@@ -11,7 +11,7 @@
     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
@@ -159,7 +159,7 @@ def getArgString(self, mapping):
         (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))


        


More information about the llvm-commits mailing list