Kaydet (Commit) 572f5233 authored tarafından Gustavo Niemeyer's avatar Gustavo Niemeyer

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

bz2 files. Also, included a testcase for this problem.
üst a649e9cb
......@@ -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()"
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment