summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-08-19 23:34:44 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-08-19 23:34:44 (GMT)
commit7fbac45287e13cf721f363614f699ffcfbcee2af (patch)
tree195177d4e165262ccb4d06e0755ca8cf32566fd1
parentc3ccaae6f3469716a7084fb2f5a34cba90b39ee6 (diff)
downloadcpython-7fbac45287e13cf721f363614f699ffcfbcee2af.zip
cpython-7fbac45287e13cf721f363614f699ffcfbcee2af.tar.gz
cpython-7fbac45287e13cf721f363614f699ffcfbcee2af.tar.bz2
_elementtree: deepcopy() now uses fast call
Issue #27128.
-rw-r--r--Modules/_elementtree.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index b32f2ad..5d124b3 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -819,9 +819,8 @@ LOCAL(PyObject *)
deepcopy(PyObject *object, PyObject *memo)
{
/* do a deep copy of the given object */
- PyObject *args;
- PyObject *result;
elementtreestate *st;
+ PyObject *stack[2];
/* Fast paths */
if (object == Py_None || PyUnicode_CheckExact(object)) {
@@ -857,12 +856,9 @@ deepcopy(PyObject *object, PyObject *memo)
return NULL;
}
- args = PyTuple_Pack(2, object, memo);
- if (!args)
- return NULL;
- result = PyObject_CallObject(st->deepcopy_obj, args);
- Py_DECREF(args);
- return result;
+ stack[0] = object;
+ stack[1] = memo;
+ return _PyObject_FastCall(st->deepcopy_obj, stack, 2, NULL);
}