diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-08-17 06:36:20 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-08-17 06:36:20 (GMT) |
commit | a12d92bec1858a76f2c5519bce07c8a00a891207 (patch) | |
tree | b31873754b0a519f72fa7758c7edbfa4452793f1 /Modules | |
parent | 10bc0f6edf4c24bffe13a0f7aae060ea477aad1e (diff) | |
parent | 1f0e7c99331750d1683287218cbab99dc26b2b83 (diff) | |
download | cpython-a12d92bec1858a76f2c5519bce07c8a00a891207.zip cpython-a12d92bec1858a76f2c5519bce07c8a00a891207.tar.gz cpython-a12d92bec1858a76f2c5519bce07c8a00a891207.tar.bz2 |
merge 3.3 (#27783)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_operator.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Modules/_operator.c b/Modules/_operator.c index adeb99e..f294769 100644 --- a/Modules/_operator.c +++ b/Modules/_operator.c @@ -801,7 +801,7 @@ static PyObject * methodcaller_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { methodcallerobject *mc; - PyObject *name, *newargs; + PyObject *name; if (PyTuple_GET_SIZE(args) < 1) { PyErr_SetString(PyExc_TypeError, "methodcaller needs at least " @@ -814,13 +814,6 @@ methodcaller_new(PyTypeObject *type, PyObject *args, PyObject *kwds) if (mc == NULL) return NULL; - newargs = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); - if (newargs == NULL) { - Py_DECREF(mc); - return NULL; - } - mc->args = newargs; - name = PyTuple_GET_ITEM(args, 0); Py_INCREF(name); mc->name = name; @@ -828,6 +821,12 @@ methodcaller_new(PyTypeObject *type, PyObject *args, PyObject *kwds) Py_XINCREF(kwds); mc->kwds = kwds; + mc->args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); + if (mc->args == NULL) { + Py_DECREF(mc); + return NULL; + } + PyObject_GC_Track(mc); return (PyObject *)mc; } |