diff options
Diffstat (limited to 'Lib/urlparse.py')
-rw-r--r-- | Lib/urlparse.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/urlparse.py b/Lib/urlparse.py index 1d065d3986..f6e20afdb8 100644 --- a/Lib/urlparse.py +++ b/Lib/urlparse.py @@ -272,8 +272,9 @@ def urldefrag(url): # Cannot use directly from urllib as it would create circular reference. # urllib uses urlparse methods ( urljoin) -_hextochr = dict(('%02x' % i, chr(i)) for i in range(256)) -_hextochr.update(('%02X' % i, chr(i)) for i in range(256)) + +_hexdig = '0123456789ABCDEFabcdef' +_hextochr = dict((a+b, chr(int(a+b,16))) for a in _hexdig for b in _hexdig) def unquote(s): """unquote('abc%20def') -> 'abc def'.""" |