[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

Antoine Pitrou report at bugs.python.org
Sun Apr 3 01:45:49 CEST 2011


Antoine Pitrou <pitrou at free.fr> added the comment:

> The tests for readline() and readlines() expect a TypeError if size is None.
> Calling size.__index__() in this case raises an AttributeError instead. Should I
> change the tests to expect an AttributeError? Alternatively, something like this
> would more closely match the behaviour of the old code:
> 
>     try:
>         size = size.__index__()
>     except AttributeError:
>         raise TypeError("Integer argument expected")

Ah, you're right, TypeError should be raised.

----------

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


More information about the Python-bugs-list mailing list