diff options
author | Gregory P. Smith <greg@krypto.org> | 2012-11-10 21:44:50 (GMT) |
---|---|---|
committer | Gregory P. Smith <greg@krypto.org> | 2012-11-10 21:44:50 (GMT) |
commit | b696610c2d0e6a5a381247b3f96bf678307a08e3 (patch) | |
tree | 53025d1bac7606ca57a71b6ec200a4f2a0dc8fc1 /Lib/urllib | |
parent | e2c574fbe5b793a5ec2921ad82d0b05ba3f68dbe (diff) | |
parent | 6b0bdab4293684a2a7e47e8e8e70076c8670eb9b (diff) | |
download | cpython-b696610c2d0e6a5a381247b3f96bf678307a08e3.zip cpython-b696610c2d0e6a5a381247b3f96bf678307a08e3.tar.gz cpython-b696610c2d0e6a5a381247b3f96bf678307a08e3.tar.bz2 |
Fixes issue #16409: The reporthook callback made by the legacy
urllib.request.urlretrieve API now properly supplies a constant
non-zero block_size as it did in Python 3.2 and 2.7. This matches the
behavior of urllib.request.URLopener.retrieve.
Diffstat (limited to 'Lib/urllib')
-rw-r--r-- | Lib/urllib/request.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 2de3b99d..d389fa9 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -208,7 +208,7 @@ def urlretrieve(url, filename=None, reporthook=None, data=None): size = int(headers["Content-Length"]) if reporthook: - reporthook(blocknum, 0, size) + reporthook(blocknum, bs, size) while True: block = fp.read(bs) @@ -218,7 +218,7 @@ def urlretrieve(url, filename=None, reporthook=None, data=None): tfp.write(block) blocknum += 1 if reporthook: - reporthook(blocknum, len(block), size) + reporthook(blocknum, bs, size) if size >= 0 and read < size: raise ContentTooShortError( |