Index: Lib/io.py =================================================================== --- Lib/io.py (revision 66050) +++ Lib/io.py (working copy) @@ -509,6 +509,8 @@ return 1 if limit is None: limit = -1 + if not isinstance(limit, int): + raise TypeError("limit must be an integer") res = bytearray() while limit < 0 or len(res) < limit: b = self.read(nreadahead()) @@ -1743,6 +1745,8 @@ raise ValueError("read from closed file") if limit is None: limit = -1 + if 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() @@ -2042,6 +2046,8 @@ raise ValueError("read from closed file") if limit is None: limit = -1 + if not isinstance(limit, int): + raise TypeError("limit must be an integer") if limit >= 0: # XXX: Hack to support limit argument, for backwards # XXX compatibility