[PATCH] D67880: [LNT] Python 3 support: use chr instead of unichr

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 21 10:22:56 PDT 2019


thopre created this revision.
thopre added reviewers: cmatthews, hubert.reinterpretcast, kristof.beyls.
thopre added a parent revision: D67879: [LNT] Python 3 support: import object when inheriting from it.
thopre added a child revision: D67881: [LNT] Python 3 support: replace xrange with Python3's range.

Use Python3's chr instead of Python2's unichr by importing it from
builtins. This was produced by running futurize's stage2
libfuturize.fixes.fix_unicode_keep_u.


https://reviews.llvm.org/D67880

Files:
  tests/server/ui/V4Pages.py


Index: tests/server/ui/V4Pages.py
===================================================================
--- tests/server/ui/V4Pages.py
+++ tests/server/ui/V4Pages.py
@@ -19,6 +19,7 @@
 
 from future import standard_library
 standard_library.install_aliases()
+from builtins import chr
 import logging
 import re
 import sys
@@ -113,7 +114,7 @@
     try:
         parser = ET.XMLParser()
         parser.parser.UseForeignDTD(True)
-        parser.entity.update((x, unichr(i)) for x, i in name2codepoint.items())
+        parser.entity.update((x, chr(i)) for x, i in name2codepoint.items())
         tree = ET.fromstring(html_string, parser=parser)
     except:  # noqa FIXME: figure out what we expect this to throw.
         dump_html(html_string)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67880.221184.patch
Type: text/x-patch
Size: 746 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190921/61fc56cf/attachment.bin>


More information about the llvm-commits mailing list