Commit 450242da authored by Kevin Modzelewski's avatar Kevin Modzelewski

Fix test_bz2.py

Fix some corner cases in the irgen refcounter, and fix a refcount
issue in the bz2 module itself.
parent bcd97937
......@@ -1420,6 +1420,9 @@ BZ2File_init(BZ2FileObject *self, PyObject *args, PyObject *kwargs)
mode = (mode_char == 'r') ? "rb" : "wb";
// Pyston change: this prevents leaking refs in the test_bz2.py test
Py_CLEAR(self->file);
self->file = PyObject_CallFunction((PyObject*)&PyFile_Type, "(Osi)",
name, mode, buffering);
if (self->file == NULL)
......
......@@ -100,7 +100,7 @@ bool RefcountTracker::isNullable(llvm::Value* v) {
}
void RefcountTracker::refConsumed(llvm::Value* v, llvm::Instruction* inst) {
if (llvm::isa<UndefValue>(v))
if (llvm::isa<UndefValue>(v) || llvm::isa<ConstantPointerNull>(v))
return;
assert(this->vars[v].reftype != RefType::UNKNOWN);
......@@ -109,7 +109,7 @@ void RefcountTracker::refConsumed(llvm::Value* v, llvm::Instruction* inst) {
}
void RefcountTracker::refUsed(llvm::Value* v, llvm::Instruction* inst) {
if (llvm::isa<UndefValue>(v))
if (llvm::isa<UndefValue>(v) || llvm::isa<ConstantPointerNull>(v))
return;
assert(this->vars[v].reftype != RefType::UNKNOWN);
......
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