diff options
author | Benjamin Peterson <benjamin@python.org> | 2016-08-17 06:37:42 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2016-08-17 06:37:42 (GMT) |
commit | 4d02b1b2bb77ea8c40dea1e3a2f17949e6ebdc63 (patch) | |
tree | b0e84be60ce2e66291392e7e220d1b16572e434c /Modules | |
parent | 17061a99b03dc101e7ab7a20ab23411f077b3efe (diff) | |
parent | 6423429325f4f2309892f530417bc9737268be38 (diff) | |
download | cpython-4d02b1b2bb77ea8c40dea1e3a2f17949e6ebdc63.zip cpython-4d02b1b2bb77ea8c40dea1e3a2f17949e6ebdc63.tar.gz cpython-4d02b1b2bb77ea8c40dea1e3a2f17949e6ebdc63.tar.bz2 |
merge 3.5 (#27783)
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_operator.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_operator.c b/Modules/_operator.c index eb4f3a3..dfff1d2 100644 --- a/Modules/_operator.c +++ b/Modules/_operator.c @@ -931,7 +931,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 " @@ -951,13 +951,7 @@ 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); PyUnicode_InternInPlace(&name); mc->name = name; @@ -965,6 +959,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; } |