[PATCH] D56261: Python compat - urllib

serge via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 03:26:50 PST 2019


serge-sans-paille created this revision.
serge-sans-paille added a reviewer: michaelplatings.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

https://reviews.llvm.org/D56261

Files:
  utils/unicode-case-fold.py


Index: utils/unicode-case-fold.py
===================================================================
--- utils/unicode-case-fold.py
+++ utils/unicode-case-fold.py
@@ -21,7 +21,11 @@
 
 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 @@
     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)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D56261.180024.patch
Type: text/x-patch
Size: 646 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190103/a4561345/attachment.bin>


More information about the llvm-commits mailing list