mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Make test_urllib.py pass. Mostly str/bytes issues.
Also fix mac toolbox glue to accept str, str8, bytes for 255-byte strings.
This commit is contained in:
parent
6718062538
commit
a098294446
3 changed files with 24 additions and 9 deletions
|
@ -245,7 +245,7 @@ class URLopener:
|
|||
reporthook(blocknum, bs, size)
|
||||
while 1:
|
||||
block = fp.read(bs)
|
||||
if block == "":
|
||||
if not block:
|
||||
break
|
||||
read += len(block)
|
||||
tfp.write(block)
|
||||
|
@ -976,7 +976,7 @@ def toBytes(url):
|
|||
|
||||
def unwrap(url):
|
||||
"""unwrap('<URL:type://host/path>') --> 'type://host/path'."""
|
||||
url = url.strip()
|
||||
url = str(url).strip()
|
||||
if url[:1] == '<' and url[-1:] == '>':
|
||||
url = url[1:-1].strip()
|
||||
if url[:4] == 'URL:': url = url[4:].strip()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue