[Python-checkins] r69854 - python/branches/io-c/Lib/_pyio.py

benjamin.peterson python-checkins at python.org
Sat Feb 21 23:49:04 CET 2009


Author: benjamin.peterson
Date: Sat Feb 21 23:49:02 2009
New Revision: 69854

Log:
check whence

Modified:
   python/branches/io-c/Lib/_pyio.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 23:49:02 2009
@@ -1111,6 +1111,8 @@
         BufferedWriter.__init__(self, raw, buffer_size, max_buffer_size)
 
     def seek(self, pos, whence=0):
+        if not (0 <= whence <= 2):
+            raise ValueError("invalid whence")
         self.flush()
         # First do the raw seek, then empty the read buffer, so that
         # if the raw seek fails, we don't lose buffered data forever.


More information about the Python-checkins mailing list