[Python-checkins] cpython: Simplify code in marshal.c.

antoine.pitrou python-checkins at python.org
Fri Mar 2 18:28:13 CET 2012


http://hg.python.org/cpython/rev/61661842f225
changeset:   75371:61661842f225
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Fri Mar 02 18:22:23 2012 +0100
summary:
  Simplify code in marshal.c.

files:
  Python/marshal.c |  8 +-------
  1 files changed, 1 insertions(+), 7 deletions(-)


diff --git a/Python/marshal.c b/Python/marshal.c
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -1239,7 +1239,6 @@
 PyMarshal_WriteObjectToString(PyObject *x, int version)
 {
     WFILE wf;
-    PyObject *res = NULL;
 
     wf.fp = NULL;
     wf.readable = NULL;
@@ -1273,12 +1272,7 @@
                :"object too deeply nested to marshal");
         return NULL;
     }
-    if (wf.str != NULL) {
-        /* XXX Quick hack -- need to do this differently */
-        res = PyBytes_FromObject(wf.str);
-        Py_DECREF(wf.str);
-    }
-    return res;
+    return wf.str;
 }
 
 /* And an interface for Python programs... */

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


More information about the Python-checkins mailing list