diff options
author | Victor Stinner <vstinner@python.org> | 2023-06-30 01:05:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-30 01:05:01 (GMT) |
commit | 8c5f74fc89e35827c52753fe620b32207d537319 (patch) | |
tree | 62a1eba40b01250e97f2c5cd263456b4cb7e734a /Modules/_elementtree.c | |
parent | e7bc8d16364bde54487eab349a29d58345e35f28 (diff) | |
download | cpython-8c5f74fc89e35827c52753fe620b32207d537319.zip cpython-8c5f74fc89e35827c52753fe620b32207d537319.tar.gz cpython-8c5f74fc89e35827c52753fe620b32207d537319.tar.bz2 |
gh-106023: Update code using _PyObject_FastCall() (#106257)
Replace _PyObject_FastCall() calls with PyObject_Vectorcall().
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r-- | Modules/_elementtree.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 21a6e4e..2a0eac4 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -882,7 +882,6 @@ LOCAL(PyObject *) deepcopy(elementtreestate *st, PyObject *object, PyObject *memo) { /* do a deep copy of the given object */ - PyObject *stack[2]; /* Fast paths */ if (object == Py_None || PyUnicode_CheckExact(object)) { @@ -917,9 +916,8 @@ deepcopy(elementtreestate *st, PyObject *object, PyObject *memo) return NULL; } - stack[0] = object; - stack[1] = memo; - return _PyObject_FastCall(st->deepcopy_obj, stack, 2); + PyObject *args[2] = {object, memo}; + return PyObject_Vectorcall(st->deepcopy_obj, args, 2, NULL); } @@ -2852,14 +2850,14 @@ treebuilder_handle_pi(TreeBuilderObject* self, PyObject* target, PyObject* text) { PyObject* pi; PyObject* this; - PyObject* stack[2] = {target, text}; if (treebuilder_flush_data(self) < 0) { return NULL; } if (self->pi_factory) { - pi = _PyObject_FastCall(self->pi_factory, stack, 2); + PyObject* args[2] = {target, text}; + pi = PyObject_Vectorcall(self->pi_factory, args, 2, NULL); if (!pi) { return NULL; } @@ -3372,7 +3370,6 @@ expat_start_ns_handler(XMLParserObject* self, const XML_Char* prefix_in, PyObject* res = NULL; PyObject* uri; PyObject* prefix; - PyObject* stack[2]; if (PyErr_Occurred()) return; @@ -3411,9 +3408,8 @@ expat_start_ns_handler(XMLParserObject* self, const XML_Char* prefix_in, return; } - stack[0] = prefix; - stack[1] = uri; - res = _PyObject_FastCall(self->handle_start_ns, stack, 2); + PyObject* args[2] = {prefix, uri}; + res = PyObject_Vectorcall(self->handle_start_ns, args, 2, NULL); Py_DECREF(uri); Py_DECREF(prefix); } @@ -3551,7 +3547,6 @@ expat_pi_handler(XMLParserObject* self, const XML_Char* target_in, PyObject* pi_target; PyObject* data; PyObject* res; - PyObject* stack[2]; if (PyErr_Occurred()) return; @@ -3581,9 +3576,8 @@ expat_pi_handler(XMLParserObject* self, const XML_Char* target_in, if (!data) goto error; - stack[0] = pi_target; - stack[1] = data; - res = _PyObject_FastCall(self->handle_pi, stack, 2); + PyObject* args[2] = {pi_target, data}; + res = PyObject_Vectorcall(self->handle_pi, args, 2, NULL); Py_XDECREF(res); Py_DECREF(data); Py_DECREF(pi_target); |