[Python-checkins] r69844 - in python/branches/io-c/Lib: _pyio.py test/test_io.py

benjamin.peterson python-checkins at python.org
Sat Feb 21 21:21:24 CET 2009


Author: benjamin.peterson
Date: Sat Feb 21 21:21:24 2009
New Revision: 69844

Log:
fix the rest of the Misc tests

Modified:
   python/branches/io-c/Lib/_pyio.py
   python/branches/io-c/Lib/test/test_io.py

Modified: python/branches/io-c/Lib/_pyio.py
==============================================================================
--- python/branches/io-c/Lib/_pyio.py	(original)
+++ python/branches/io-c/Lib/_pyio.py	Sat Feb 21 21:21:24 2009
@@ -23,7 +23,9 @@
     """Exception raised when I/O would block on a non-blocking I/O stream."""
 
     def __init__(self, errno, strerror, characters_written=0):
-        IOError.__init__(self, errno, strerror)
+        super().__init__(errno, strerror)
+        if not isinstance(characters_written, int):
+            raise TypeError("characters_written must be a integer")
         self.characters_written = characters_written
 
 
@@ -551,6 +553,7 @@
 
 
 from _io import FileIO
+IOBase.register(FileIO)
 
 
 class BufferedIOBase(IOBase):

Modified: python/branches/io-c/Lib/test/test_io.py
==============================================================================
--- python/branches/io-c/Lib/test/test_io.py	(original)
+++ python/branches/io-c/Lib/test/test_io.py	Sat Feb 21 21:21:24 2009
@@ -1969,7 +1969,6 @@
             self.assertRaises(ValueError, f.fileno)
             self.assertRaises(ValueError, f.isatty)
             self.assertRaises(ValueError, f.__iter__)
-            self.assertRaises(ValueError, next, f)
             if hasattr(f, "peek"):
                 self.assertRaises(ValueError, f.peek, 1)
             self.assertRaises(ValueError, f.read)
@@ -1985,6 +1984,7 @@
             self.assertRaises(ValueError, f.write,
                               b"" if "b" in kwargs['mode'] else "")
             self.assertRaises(ValueError, f.writelines, [])
+            self.assertRaises(ValueError, next, f)
 
     def test_blockingioerror(self):
         # Various BlockingIOError issues


More information about the Python-checkins mailing list