Skip to content

Commit

Permalink
add missing Py_INCREFs for return values
Browse files Browse the repository at this point in the history
The previous commit failed CI because of this mistake, and I was
probably just making a virtualenv mistake when I tried to test it
locally.
  • Loading branch information
oconnor663 committed Feb 4, 2024
1 parent 796b54c commit 13d4b02
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion c_impl/blake3module.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ static PyObject *Blake3_update(Blake3Object *self, PyObject *args) {
Blake3_unlock_self(self);
}

// success
// Success. We need to increment the refcount on self to return it, see:
// https://docs.python.org/3/extending/extending.html#ownership-rules.
Py_INCREF(self);
ret = self;

exit:
Expand Down Expand Up @@ -267,6 +269,9 @@ static PyObject *Blake3_update_mmap(Blake3Object *self, PyObject *args,
goto exit;
}

// Success. We need to increment the refcount on self to return it, see:
// https://docs.python.org/3/extending/extending.html#ownership-rules.
Py_INCREF(self);
ret = self;

exit:
Expand Down

0 comments on commit 13d4b02

Please sign in to comment.