From 17afcab09d3e8a850fdf86d0e4024631f5a465bc Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Fri, 24 Apr 2009 23:29:56 +0000 Subject: [PATCH] allow only ints in readline --- Lib/io.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Lib/io.py b/Lib/io.py index 9a34d1664779..db4f11f4d5a2 100644 --- a/Lib/io.py +++ b/Lib/io.py @@ -505,6 +505,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()) @@ -1752,6 +1754,8 @@ class TextIOWrapper(TextIOBase): self._checkClosed() 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() -- 2.47.3