]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
allow only ints in readline
authorBenjamin Peterson <benjamin@python.org>
Fri, 24 Apr 2009 23:29:56 +0000 (23:29 +0000)
committerBenjamin Peterson <benjamin@python.org>
Fri, 24 Apr 2009 23:29:56 +0000 (23:29 +0000)
Lib/io.py

index 9a34d1664779ddb263f66d5df6dd587850ef91cf..db4f11f4d5a2b197dc4db40e69d3cef00f37f055 100644 (file)
--- 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()