diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-04-24 22:59:52 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-04-24 22:59:52 (GMT) |
commit | b01138a66ec36104079987fdd12155716bda3686 (patch) | |
tree | 37c38246a0db7f83f89b7926724b2a58a41eb481 /Lib/_pyio.py | |
parent | 34596a90c8ff860e989df52c818340266afa740a (diff) | |
download | cpython-b01138a66ec36104079987fdd12155716bda3686.zip cpython-b01138a66ec36104079987fdd12155716bda3686.tar.gz cpython-b01138a66ec36104079987fdd12155716bda3686.tar.bz2 |
readline() args must be an int #3521
Diffstat (limited to 'Lib/_pyio.py')
-rw-r--r-- | Lib/_pyio.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/_pyio.py b/Lib/_pyio.py index fe020fd..e580366 100644 --- a/Lib/_pyio.py +++ b/Lib/_pyio.py @@ -460,6 +460,8 @@ class IOBase(metaclass=abc.ABCMeta): return 1 if limit is None: limit = -1 + elif not isinstance(limit, int): + raise TypeError("limit must be an integer") res = bytearray() while limit < 0 or len(res) < limit: b = self.read(nreadahead()) @@ -1741,6 +1743,8 @@ class TextIOWrapper(TextIOBase): raise ValueError("read from closed file") if limit is None: limit = -1 + elif not isinstance(limit, int): + raise TypeError("limit must be an integer") # Grab all the decoded text (we will rewind any extra bits later). line = self._get_decoded_chars() |