From: Benjamin Peterson Date: Fri, 24 Apr 2009 23:29:56 +0000 (+0000) Subject: allow only ints in readline X-Git-Tag: 3.0~183 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=17afcab09d3e8a850fdf86d0e4024631f5a465bc;p=thirdparty%2FPython%2Fcpython.git allow only ints in readline --- 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()