summaryrefslogtreecommitdiffstats
path: root/Modules/_io/textio.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-12-08 23:36:19 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-12-08 23:36:19 (GMT)
commit7e42541d08b6cc103b892c1cb70ea68c66751078 (patch)
tree082013fb3c953cb156f6591cbc3bcca6db787ca8 /Modules/_io/textio.c
parent4c38154a432885a933b539c2682e66caaf440117 (diff)
downloadcpython-7e42541d08b6cc103b892c1cb70ea68c66751078.zip
cpython-7e42541d08b6cc103b892c1cb70ea68c66751078.tar.gz
cpython-7e42541d08b6cc103b892c1cb70ea68c66751078.tar.bz2
Use _PyObject_CallMethodIdObjArgs()
Issue #28915: Replace _PyObject_CallMethodId() with _PyObject_CallMethodIdObjArgs() when the format string only use the format 'O' for objects, like "(O)". _PyObject_CallMethodIdObjArgs() avoids the code to parse a format string and avoids the creation of a temporary tuple.
Diffstat (limited to 'Modules/_io/textio.c')
-rw-r--r--Modules/_io/textio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index 1c7200b..d28f613 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -2435,7 +2435,7 @@ _io_TextIOWrapper_tell_impl(textio *self)
}
finally:
- res = _PyObject_CallMethodId(self->decoder, &PyId_setstate, "(O)", saved_state);
+ res = _PyObject_CallMethodIdObjArgs(self->decoder, &PyId_setstate, saved_state, NULL);
Py_DECREF(saved_state);
if (res == NULL)
return NULL;
@@ -2449,7 +2449,7 @@ fail:
if (saved_state) {
PyObject *type, *value, *traceback;
PyErr_Fetch(&type, &value, &traceback);
- res = _PyObject_CallMethodId(self->decoder, &PyId_setstate, "(O)", saved_state);
+ res = _PyObject_CallMethodIdObjArgs(self->decoder, &PyId_setstate, saved_state, NULL);
_PyErr_ChainExceptions(type, value, traceback);
Py_DECREF(saved_state);
Py_XDECREF(res);