[Python-checkins] cpython: _elementtree: deepcopy() now uses fast call
victor.stinner
python-checkins at python.org
Fri Aug 19 19:50:44 EDT 2016
https://hg.python.org/cpython/rev/abb93035ebb7
changeset: 102787:abb93035ebb7
user: Victor Stinner <victor.stinner at gmail.com>
date: Sat Aug 20 01:34:44 2016 +0200
summary:
_elementtree: deepcopy() now uses fast call
Issue #27128.
files:
Modules/_elementtree.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -819,9 +819,8 @@
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 @@
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);
}
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list