[Python-checkins] r71859 - python/branches/release30-maint/Lib/io.py

benjamin.peterson python-checkins at python.org
Sat Apr 25 01:29:56 CEST 2009


Author: benjamin.peterson
Date: Sat Apr 25 01:29:56 2009
New Revision: 71859

Log:
allow only ints in readline

Modified:
   python/branches/release30-maint/Lib/io.py

Modified: python/branches/release30-maint/Lib/io.py
==============================================================================
--- python/branches/release30-maint/Lib/io.py	(original)
+++ python/branches/release30-maint/Lib/io.py	Sat Apr 25 01:29:56 2009
@@ -505,6 +505,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())
@@ -1752,6 +1754,8 @@
         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()


More information about the Python-checkins mailing list