Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 359fabc

Browse files
committed
Issue #19437: Cleanup r_ref() of the marshal module
1 parent d5cae6f commit 359fabc

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

Python/marshal.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -827,11 +827,12 @@ r_ref_insert(PyObject *o, Py_ssize_t idx, int flag, RFILE *p)
827827
static PyObject *
828828
r_ref(PyObject *o, int flag, RFILE *p)
829829
{
830-
if (o != NULL && flag) { /* currently only FLAG_REF is defined */
831-
if (PyList_Append(p->refs, o) < 0) {
832-
Py_DECREF(o); /* release the new object */
833-
return NULL;
834-
}
830+
assert(flag & FLAG_REF);
831+
if (o == NULL)
832+
return NULL;
833+
if (PyList_Append(p->refs, o) < 0) {
834+
Py_DECREF(o); /* release the new object */
835+
return NULL;
835836
}
836837
return o;
837838
}

0 commit comments

Comments
 (0)