readline() args must be an int #3521
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 @@
                 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 @@
             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()