HomePhabricator

Convert old python3 cgi method into the new html one

Authored by Gianfranco Costamagna <costamagnagianfranco@yahoo.it> on Mar 25 2020, 2:38 PM.

Description

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

Event Timeline

sylvestre.ledru committed rG4b428e8f18c7: Convert old python3 cgi method into the new html one (authored by Gianfranco Costamagna <costamagnagianfranco@yahoo.it>).Mar 25 2020, 2:38 PM

Hi,

This commit broke our validations. Specifically, the tests in llvm/test/tools/opt-viewer

These tests have expected outputs which are diffed against. Changing from cgi.escape to html.escape changes the behavior of the operation.

> python2
Python 2.7.6 (default, Nov 23 2017, 15:49:48) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cgi
>>> cgi.escape("\"abc\"")
'"abc"'
> python3
Python 3.6.5 (default, Mar 29 2018, 00:00:00) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import html
>>> html.escape("\"abi\"")
'&quot;abi&quot;'
>>> exit()

Either the calls to html.escape must also send in quote=False, or the files used in tests "llvm_regressions/LLVM/tools/opt-viewer/unicode-function-name.test" and "llvm_regressions/LLVM/tools/opt-viewer/suppress.test" need to be updated with escaped quotes.