mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Issue #16304: Further optimize BZ2File.readlines?().
This commit is contained in:
parent
138ad5066d
commit
eb70be2b46
1 changed files with 8 additions and 6 deletions
|
@ -319,6 +319,7 @@ class BZ2File(io.BufferedIOBase):
|
||||||
non-negative, no more than size bytes will be read (in which
|
non-negative, no more than size bytes will be read (in which
|
||||||
case the line may be incomplete). Returns b'' if already at EOF.
|
case the line may be incomplete). Returns b'' if already at EOF.
|
||||||
"""
|
"""
|
||||||
|
if not isinstance(size, int):
|
||||||
if not hasattr(size, "__index__"):
|
if not hasattr(size, "__index__"):
|
||||||
raise TypeError("Integer argument expected")
|
raise TypeError("Integer argument expected")
|
||||||
size = size.__index__()
|
size = size.__index__()
|
||||||
|
@ -341,6 +342,7 @@ class BZ2File(io.BufferedIOBase):
|
||||||
further lines will be read once the total size of the lines read
|
further lines will be read once the total size of the lines read
|
||||||
so far equals or exceeds size.
|
so far equals or exceeds size.
|
||||||
"""
|
"""
|
||||||
|
if not isinstance(size, int):
|
||||||
if not hasattr(size, "__index__"):
|
if not hasattr(size, "__index__"):
|
||||||
raise TypeError("Integer argument expected")
|
raise TypeError("Integer argument expected")
|
||||||
size = size.__index__()
|
size = size.__index__()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue