##// END OF EJS Templates
py3: add a new bytesurl() to convert a str url into bytes
Pulkit Goyal -
r32860:f22f39d5 default
parent child Browse files
Show More
@@ -177,6 +177,10 b' if ispy3:'
177 """Converts a bytes url back to str"""
177 """Converts a bytes url back to str"""
178 return url.decode(u'ascii')
178 return url.decode(u'ascii')
179
179
180 def bytesurl(url):
181 """Converts a str url to bytes by encoding in ascii"""
182 return url.encode(u'ascii')
183
180 def raisewithtb(exc, tb):
184 def raisewithtb(exc, tb):
181 """Raise exception with the given traceback"""
185 """Raise exception with the given traceback"""
182 raise exc.with_traceback(tb)
186 raise exc.with_traceback(tb)
@@ -249,6 +253,7 b' else:'
249 sysbytes = identity
253 sysbytes = identity
250 sysstr = identity
254 sysstr = identity
251 strurl = identity
255 strurl = identity
256 bytesurl = identity
252
257
253 # this can't be parsed on Python 3
258 # this can't be parsed on Python 3
254 exec('def raisewithtb(exc, tb):\n'
259 exec('def raisewithtb(exc, tb):\n'
General Comments 0
You need to be logged in to leave comments. Login now