Index: Python/marshal.c =================================================================== --- Python/marshal.c (revision 61058) +++ Python/marshal.c (working copy) @@ -899,6 +899,7 @@ int nlocals; int stacksize; int flags; + int rc; PyObject *code = NULL; PyObject *consts = NULL; PyObject *names = NULL; @@ -946,6 +947,15 @@ if (lnotab == NULL) goto code_error; + /* Conserve memory if possible. */ + rc = PyObject_RichCompareBool(names, varnames, Py_EQ); + if (rc == 1) { + Py_DECREF(names); + names = varnames; + Py_INCREF(names); + } else if (rc == -1) + PyErr_Clear(); + v = (PyObject *) PyCode_New( argcount, nlocals, stacksize, flags, code, consts, names, varnames,