[PATCH] D56261: Python compat - urllib

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 06:17:27 PST 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL350315: Python compat - urllib (authored by serge_sans_paille, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D56261?vs=180024&id=180060#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56261/new/

https://reviews.llvm.org/D56261

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


Index: llvm/trunk/utils/unicode-case-fold.py
===================================================================
--- llvm/trunk/utils/unicode-case-fold.py
+++ llvm/trunk/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.180060.patch
Type: text/x-patch
Size: 679 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190103/9dc9c907/attachment.bin>


More information about the llvm-commits mailing list