diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-12-09 15:09:30 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-12-09 15:09:30 (GMT) |
commit | 55ba38a48097e4b21b406cc617df1481727f5c25 (patch) | |
tree | 623f4fa4c83ecbdd1c0170399ca72741fbe0fb82 /Python | |
parent | 61bdb0d31924ec5fd12aa8dbe197002c57dfbf82 (diff) | |
download | cpython-55ba38a48097e4b21b406cc617df1481727f5c25.zip cpython-55ba38a48097e4b21b406cc617df1481727f5c25.tar.gz cpython-55ba38a48097e4b21b406cc617df1481727f5c25.tar.bz2 |
Use _PyObject_CallMethodIdObjArgs()
Issue #28915: Replace _PyObject_CallMethodId() with
_PyObject_CallMethodIdObjArgs() in various modules when the format string was
only made of "O" formats, PyObject* arguments.
_PyObject_CallMethodIdObjArgs() avoids the creation of a temporary tuple and
doesn't have to parse a format string.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 2 | ||||
-rw-r--r-- | Python/import.c | 2 | ||||
-rw-r--r-- | Python/marshal.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index 189bf70..588fabb 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -26,7 +26,7 @@ check_matched(PyObject *obj, PyObject *arg) if (obj == Py_None) return 1; - result = _PyObject_CallMethodId(obj, &PyId_match, "O", arg); + result = _PyObject_CallMethodIdObjArgs(obj, &PyId_match, arg, NULL); if (result == NULL) return -1; diff --git a/Python/import.c b/Python/import.c index 6bcb1d7..aef1800 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1705,7 +1705,7 @@ PyImport_ReloadModule(PyObject *m) Py_INCREF(imp); } - reloaded_module = _PyObject_CallMethodId(imp, &PyId_reload, "O", m); + reloaded_module = _PyObject_CallMethodIdObjArgs(imp, &PyId_reload, m, NULL); Py_DECREF(imp); return reloaded_module; } diff --git a/Python/marshal.c b/Python/marshal.c index 0889e41..d71d3c2 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1649,7 +1649,7 @@ marshal_dump(PyObject *self, PyObject *args) s = PyMarshal_WriteObjectToString(x, version); if (s == NULL) return NULL; - res = _PyObject_CallMethodId(f, &PyId_write, "O", s); + res = _PyObject_CallMethodIdObjArgs(f, &PyId_write, s, NULL); Py_DECREF(s); return res; } |