mirror of
https://github.com/python/cpython.git
synced 2024-11-26 03:14:27 +08:00
Applying patch #728656, by logistix, fixing opening of nonexistent
bz2 files. Also, included a testcase for this problem.
This commit is contained in:
parent
a649e9cb7a
commit
572f5233f0
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user