[Python-checkins] cpython: Issue #19437: Cleanup r_ref() of the marshal module

victor.stinner python-checkins at python.org
Thu Oct 31 17:24:04 CET 2013


http://hg.python.org/cpython/rev/995173ed248a
changeset:   86810:995173ed248a
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Thu Oct 31 17:09:01 2013 +0100
summary:
  Issue #19437: Cleanup r_ref() of the marshal module

files:
  Python/marshal.c |  11 ++++++-----
  1 files changed, 6 insertions(+), 5 deletions(-)


diff --git a/Python/marshal.c b/Python/marshal.c
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -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;
 }

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list