[pypy-svn] r61521 - pypy/trunk/pypy/module/bz2

fijal at codespeak.net fijal at codespeak.net
Mon Feb 2 16:44:46 CET 2009


Author: fijal
Date: Mon Feb  2 16:44:44 2009
New Revision: 61521

Modified:
   pypy/trunk/pypy/module/bz2/interp_bz2.py
Log:
seems that bz2 has a bit more relaxed rules than normal files
(ie 'U' does not mean we cannot use 'a' or 'w')


Modified: pypy/trunk/pypy/module/bz2/interp_bz2.py
==============================================================================
--- pypy/trunk/pypy/module/bz2/interp_bz2.py	(original)
+++ pypy/trunk/pypy/module/bz2/interp_bz2.py	Mon Feb  2 16:44:44 2009
@@ -173,6 +173,12 @@
 
 class W_BZ2File(W_File):
 
+    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_ValueError,
+                                 space.wrap('invalid mode : "%s"' % mode))
+
     def direct_bz2__init__(self, w_name, mode='r', buffering=-1,
                            compresslevel=9):
         self.direct_close()



More information about the Pypy-commit mailing list