summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/test_bz2.py5
-rw-r--r--Modules/bz2module.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index 9134aae..64ce6ab 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -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()"
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index 1fb6665..9289a02 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -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);
}