[PATCH] D76126: Convert old python3 cgi method into the new html one

Sylvestre Ledru via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 13 05:06:52 PDT 2020


sylvestre.ledru created this revision.
sylvestre.ledru added a reviewer: serge-sans-paille.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
sylvestre.ledru edited the summary of this revision.

Patch by Gianfranco Costamagna


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76126

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


Index: llvm/tools/opt-viewer/optrecord.py
===================================================================
--- llvm/tools/opt-viewer/optrecord.py
+++ 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 @@
         (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))
Index: llvm/tools/opt-viewer/opt-viewer.py
===================================================================
--- llvm/tools/opt-viewer/opt-viewer.py
+++ 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 @@
         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>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76126.250178.patch
Type: text/x-patch
Size: 1486 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200313/47373205/attachment.bin>


More information about the llvm-commits mailing list