py3: add a new strurl() which will convert a bytes url to str

This commit is contained in:
Pulkit Goyal 2017-06-16 00:32:52 +05:30
parent 00240434ab
commit 6554e26b45

View File

@ -173,6 +173,10 @@ if ispy3:
return s
return s.decode(u'latin-1')
def strurl(url):
"""Converts a bytes url back to str"""
return url.decode(u'ascii')
def raisewithtb(exc, tb):
"""Raise exception with the given traceback"""
raise exc.with_traceback(tb)
@ -244,6 +248,7 @@ else:
iterbytestr = iter
sysbytes = identity
sysstr = identity
strurl = identity
# this can't be parsed on Python 3
exec('def raisewithtb(exc, tb):\n'