[llvm] r350315 - Python compat - urllib

Serge Guelton via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 06:12:44 PST 2019


Author: serge_sans_paille
Date: Thu Jan  3 06:12:44 2019
New Revision: 350315

URL: http://llvm.org/viewvc/llvm-project?rev=350315&view=rev
Log:
Python compat - urllib

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

Modified:
    llvm/trunk/utils/unicode-case-fold.py

Modified: llvm/trunk/utils/unicode-case-fold.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/unicode-case-fold.py?rev=350315&r1=350314&r2=350315&view=diff
==============================================================================
--- llvm/trunk/utils/unicode-case-fold.py (original)
+++ llvm/trunk/utils/unicode-case-fold.py Thu Jan  3 06:12:44 2019
@@ -21,7 +21,11 @@ from __future__ import print_function
 
 import sys
 import re
-import urllib2
+try:
+    from urllib.request import urlopen
+except ImportError:
+    from urllib2 import urlopen
+
 
 # This variable will body of the mappings function
 body = ""
@@ -95,7 +99,7 @@ def dump_block(b):
     body += pattern.format(last, stride(b), modulo, shift(b[0]))
 
 current_block = []
-f = urllib2.urlopen(sys.argv[1])
+f = urlopen(sys.argv[1])
 for m in mappings(f):
     if len(current_block) == 0:
         current_block.append(m)




More information about the llvm-commits mailing list