mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
py3: add a new bytesurl() to convert a str url into bytes
This commit is contained in:
parent
6554e26b45
commit
fc04ed5c12
@ -177,6 +177,10 @@ if ispy3:
|
||||
"""Converts a bytes url back to str"""
|
||||
return url.decode(u'ascii')
|
||||
|
||||
def bytesurl(url):
|
||||
"""Converts a str url to bytes by encoding in ascii"""
|
||||
return url.encode(u'ascii')
|
||||
|
||||
def raisewithtb(exc, tb):
|
||||
"""Raise exception with the given traceback"""
|
||||
raise exc.with_traceback(tb)
|
||||
@ -249,6 +253,7 @@ else:
|
||||
sysbytes = identity
|
||||
sysstr = identity
|
||||
strurl = identity
|
||||
bytesurl = identity
|
||||
|
||||
# this can't be parsed on Python 3
|
||||
exec('def raisewithtb(exc, tb):\n'
|
||||
|
Loading…
Reference in New Issue
Block a user