summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-10-31 16:09:01 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-10-31 16:09:01 (GMT)
commit359fabc19f28187305c9212796f390b5b4d8d64a (patch)
tree328976ffdf79c33b79602eb4bfa3af73546be64d
parentd5cae6f143fbb24fde667f28bf42e8e4fb0ea1dc (diff)
downloadcpython-359fabc19f28187305c9212796f390b5b4d8d64a.zip
cpython-359fabc19f28187305c9212796f390b5b4d8d64a.tar.gz
cpython-359fabc19f28187305c9212796f390b5b4d8d64a.tar.bz2
Issue #19437: Cleanup r_ref() of the marshal module
-rw-r--r--Python/marshal.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/Python/marshal.c b/Python/marshal.c
index e19aff0..e211a0f 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -827,11 +827,12 @@ r_ref_insert(PyObject *o, Py_ssize_t idx, int flag, RFILE *p)
static PyObject *
r_ref(PyObject *o, int flag, RFILE *p)
{
- if (o != NULL && flag) { /* currently only FLAG_REF is defined */
- if (PyList_Append(p->refs, o) < 0) {
- Py_DECREF(o); /* release the new object */
- return NULL;
- }
+ assert(flag & FLAG_REF);
+ if (o == NULL)
+ return NULL;
+ if (PyList_Append(p->refs, o) < 0) {
+ Py_DECREF(o); /* release the new object */
+ return NULL;
}
return o;
}