mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Fix a few urllib bugs (NameErrors).
Also directly import names from the various urllib submodules, saves attribute lookup and is much cleaner.
This commit is contained in:
parent
1abcbf8e19
commit
13e89463e3
2 changed files with 125 additions and 126 deletions
|
@ -416,11 +416,11 @@ def urlencode(query,doseq=0):
|
|||
# urllib.parse.unquote('abc%20def') -> 'abc def'
|
||||
# quote('abc def') -> 'abc%20def')
|
||||
|
||||
def toBytes(url):
|
||||
"""toBytes(u"URL") --> 'URL'."""
|
||||
def to_bytes(url):
|
||||
"""to_bytes(u"URL") --> 'URL'."""
|
||||
# Most URL schemes require ASCII. If that changes, the conversion
|
||||
# can be relaxed.
|
||||
# XXX get rid of toBytes()
|
||||
# XXX get rid of to_bytes()
|
||||
if isinstance(url, str):
|
||||
try:
|
||||
url = url.encode("ASCII").decode()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue