Show More
@@ -269,7 +269,6 b' if not ispy3:' | |||
|
269 | 269 | else: |
|
270 | 270 | import urllib.parse |
|
271 | 271 | urlreq._registeraliases(urllib.parse, ( |
|
272 | "quote", | |
|
273 | 272 | "splitattr", |
|
274 | 273 | "splitpasswd", |
|
275 | 274 | "splitport", |
@@ -313,3 +312,12 b' else:' | |||
|
313 | 312 | "SimpleHTTPRequestHandler", |
|
314 | 313 | "CGIHTTPRequestHandler", |
|
315 | 314 | )) |
|
315 | ||
|
316 | # urllib.parse.quote() accepts both str and bytes, decodes bytes | |
|
317 | # (if necessary), and returns str. This is wonky. We provide a custom | |
|
318 | # implementation that only accepts bytes and emits bytes. | |
|
319 | def quote(s, safe=r'/'): | |
|
320 | s = urllib.parse.quote_from_bytes(s, safe=safe) | |
|
321 | return s.encode('ascii', 'strict') | |
|
322 | ||
|
323 | urlreq.quote = quote |
General Comments 0
You need to be logged in to leave comments.
Login now