Applying patch #728656, by logistix, fixing opening of nonexistent

bz2 files. Also, included a testcase for this problem.
This commit is contained in:
Gustavo Niemeyer 2003-04-29 14:53:08 +00:00
parent a649e9cb7a
commit 572f5233f0
2 changed files with 6 additions and 1 deletions

View File

@ -219,11 +219,16 @@ class BZ2FileTest(BaseTest):
bz2f.close()
def testOpenDel(self):
# "Test opening and deleting a file many times"
self.createTempFile()
for i in xrange(10000):
o = BZ2File(self.filename)
del o
def testOpenNonexistent(self):
# "Test opening a nonexistent file"
self.assertRaises(IOError, BZ2File, "/non/existent")
class BZ2CompressorTest(BaseTest):
def testCompress(self):
# "Test BZ2Compressor.compress()/flush()"

View File

@ -1388,7 +1388,7 @@ BZ2File_dealloc(BZ2FileObject *self)
break;
}
Util_DropReadAhead(self);
Py_DECREF(self->file);
Py_XDECREF(self->file);
self->ob_type->tp_free((PyObject *)self);
}