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.
diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py
index 27ab2b9..5ddec5f 100644
--- a/Lib/urllib/request.py
+++ b/Lib/urllib/request.py
@@ -208,7 +208,7 @@
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 @@
tfp.write(block)
blocknum += 1
if reporthook:
- reporthook(blocknum, len(block), size)
+ reporthook(blocknum, bs, size)
if size >= 0 and read < size:
raise ContentTooShortError(