[issue16409] urlretrieve regression: first call returns block size as 0

akira report at bugs.python.org
Mon Nov 5 08:13:48 CET 2012


akira added the comment:

Summary: It is a new behavior. There is no need to change either code or
         docs. Though docs could be clarified to be more explicit.
  
 
The behavior has been introduced only in 3.3 in revision 53715804dc71 
[1] from issue 10050 [2]

It knownly breaks backward-compatibility. The docstring says:

> The reporthook argument should be a callable that accepts a block
> number, a read size, and the total file size of the URL target.

The change was rejected in issue 849407 [3]

Though it is not mentioned in Misc/NEWS and 
Doc/library/urllib.request.rst doesn't mention the change from a static
block size to a read size explicitly:

> The third argument, if present, is a hook function that will be called 
> once on establishment of the network connection and once after each 
> block read thereafter.  The hook will be passed three arguments; a 
> count of blocks transferred so far, a block size in bytes, and the 
> total size of the file.

*after each block read* and *block size in bytes* do not suggest that 
the block size must be constant. This part in the docs could be more 
clear.

There is related issue 1490929 [4]

[1]: http://hg.python.org/cpython/rev/53715804dc71
[2]: http://bugs.python.org/issue10050
[3]: http://bugs.python.org/issue849407
[4]: http://bugs.python.org/issue1490929

----------
nosy: +akira
type:  -> behavior
versions:  -Python 3.1, Python 3.2

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16409>
_______________________________________


More information about the Python-bugs-list mailing list