Brian Kearns  committed b8a0ce7

ensure bz2 file sets name attribute before opening

  • Participants
  • Parent commits e9d8dfe
  • Branches stdlib-2.7.8

Comments (0)

Files changed (2)

File pypy/module/bz2/

     def direct_bz2__init__(self, w_name, mode='r', buffering=-1,
+        self.w_name = w_name
         # the stream should always be opened in binary mode
         if "b" not in mode:
             mode = mode + "b"

File pypy/module/bz2/test/

         # a large buf size
         BZ2File(self.temppath, mode='w', buffering=4096)
+        exc = raises(IOError, BZ2File, 'xxx', 'r')
+        assert "'xxx'" in str(exc.value)
     def test_close(self):
         from bz2 import BZ2File