[pypy-svn] r58826 - in pypy/branch/2.5-merge/pypy/module/_file: . test

cfbolz at codespeak.net cfbolz at codespeak.net
Wed Oct 8 15:47:40 CEST 2008


Author: cfbolz
Date: Wed Oct  8 15:47:40 2008
New Revision: 58826

Modified:
   pypy/branch/2.5-merge/pypy/module/_file/interp_file.py
   pypy/branch/2.5-merge/pypy/module/_file/test/test_file.py
Log:
(iko, cfbolz): raise ValueError instead of IOError when the mode is nonsensical


Modified: pypy/branch/2.5-merge/pypy/module/_file/interp_file.py
==============================================================================
--- pypy/branch/2.5-merge/pypy/module/_file/interp_file.py	(original)
+++ pypy/branch/2.5-merge/pypy/module/_file/interp_file.py	Wed Oct  8 15:47:40 2008
@@ -50,7 +50,7 @@
     def check_mode_ok(self, mode):
         if not mode or mode[0] not in ['r', 'w', 'a', 'U']:
             space = self.space
-            raise OperationError(space.w_IOError,
+            raise OperationError(space.w_ValueError,
                                  space.wrap('invalid mode : "%s"' % mode))
 
     def getstream(self):

Modified: pypy/branch/2.5-merge/pypy/module/_file/test/test_file.py
==============================================================================
--- pypy/branch/2.5-merge/pypy/module/_file/test/test_file.py	(original)
+++ pypy/branch/2.5-merge/pypy/module/_file/test/test_file.py	Wed Oct  8 15:47:40 2008
@@ -86,7 +86,7 @@
             f.close()
 
     def test_badmode(self):
-        raises(IOError, self.file, "foo", "bar")
+        raises(ValueError, self.file, "foo", "bar")
 
     def test_wraposerror(self):
         raises(IOError, self.file, "hopefully/not/existant.bar")



More information about the Pypy-commit mailing list