mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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.
This commit is contained in:
parent
4c38154a43
commit
7e42541d08
3 changed files with 5 additions and 4 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue