diff Python/marshal.c @ 86810:995173ed248a

Issue #19437: Cleanup r_ref() of the marshal module
author Victor Stinner <victor.stinner@gmail.com>
date Thu, 31 Oct 2013 17:09:01 +0100
parents fc54e2848c98
children e086cb1c6e5a
line wrap: on
line diff
--- a/Python/marshal.c	Thu Oct 31 17:14:52 2013 +0100
+++ b/Python/marshal.c	Thu Oct 31 17:09:01 2013 +0100
@@ -827,11 +827,12 @@
 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;
 }