Commit b7e1e99f authored by Georg Brandl's avatar Georg Brandl

Fix a few urllib bugs (NameErrors).

Also directly import names from the various urllib submodules,
saves attribute lookup and is much cleaner.
parent 401fb814
...@@ -416,11 +416,11 @@ def urlencode(query,doseq=0): ...@@ -416,11 +416,11 @@ def urlencode(query,doseq=0):
# urllib.parse.unquote('abc%20def') -> 'abc def' # urllib.parse.unquote('abc%20def') -> 'abc def'
# quote('abc def') -> 'abc%20def') # quote('abc def') -> 'abc%20def')
def toBytes(url): def to_bytes(url):
"""toBytes(u"URL") --> 'URL'.""" """to_bytes(u"URL") --> 'URL'."""
# Most URL schemes require ASCII. If that changes, the conversion # Most URL schemes require ASCII. If that changes, the conversion
# can be relaxed. # can be relaxed.
# XXX get rid of toBytes() # XXX get rid of to_bytes()
if isinstance(url, str): if isinstance(url, str):
try: try:
url = url.encode("ASCII").decode() url = url.encode("ASCII").decode()
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment