diff options
author | Jeroen Demeyer <J.Demeyer@UGent.be> | 2019-07-11 10:59:05 +0200 |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-07-11 17:59:05 +0900 |
commit | 59ad110d7a7784d53d0b502eebce0346597a6bef (patch) | |
tree | 8ccd39e358017efe2abe41912c2f9d567ee9f248 /Python | |
parent | 2a3d4d9c53dd4831c3ecf56bc7c4a289c33030d6 (diff) | |
download | cpython-git-59ad110d7a7784d53d0b502eebce0346597a6bef.tar.gz |
bpo-37547: add _PyObject_CallMethodOneArg (GH-14685)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 2 | ||||
-rw-r--r-- | Python/ceval.c | 2 | ||||
-rw-r--r-- | Python/import.c | 12 | ||||
-rw-r--r-- | Python/marshal.c | 2 | ||||
-rw-r--r-- | Python/sysmodule.c | 6 |
5 files changed, 10 insertions, 14 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index b1762e6bed..ecee399db6 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -164,7 +164,7 @@ check_matched(PyObject *obj, PyObject *arg) } /* Otherwise assume a regex filter and call its match() method */ - result = _PyObject_CallMethodIdObjArgs(obj, &PyId_match, arg, NULL); + result = _PyObject_CallMethodIdOneArg(obj, &PyId_match, arg); if (result == NULL) return -1; diff --git a/Python/ceval.c b/Python/ceval.c index fdd299561c..7c7359166d 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2052,7 +2052,7 @@ main_loop: if (v == Py_None) retval = Py_TYPE(receiver)->tp_iternext(receiver); else - retval = _PyObject_CallMethodIdObjArgs(receiver, &PyId_send, v, NULL); + retval = _PyObject_CallMethodIdOneArg(receiver, &PyId_send, v); } Py_DECREF(v); if (retval == NULL) { diff --git a/Python/import.c b/Python/import.c index df258751c8..15f1d94176 100644 --- a/Python/import.c +++ b/Python/import.c @@ -962,9 +962,8 @@ PyImport_ExecCodeModuleWithPathnames(const char *name, PyObject *co, external= PyObject_GetAttrString(interp->importlib, "_bootstrap_external"); if (external != NULL) { - pathobj = _PyObject_CallMethodIdObjArgs(external, - &PyId__get_sourcefile, cpathobj, - NULL); + pathobj = _PyObject_CallMethodIdOneArg( + external, &PyId__get_sourcefile, cpathobj); Py_DECREF(external); } if (pathobj == NULL) @@ -1827,9 +1826,8 @@ PyImport_ImportModuleLevelObject(PyObject *name, PyObject *globals, */ spec = _PyObject_GetAttrId(mod, &PyId___spec__); if (_PyModuleSpec_IsInitializing(spec)) { - PyObject *value = _PyObject_CallMethodIdObjArgs(interp->importlib, - &PyId__lock_unlock_module, abs_name, - NULL); + PyObject *value = _PyObject_CallMethodIdOneArg( + interp->importlib, &PyId__lock_unlock_module, abs_name); if (value == NULL) { Py_DECREF(spec); goto error; @@ -1968,7 +1966,7 @@ PyImport_ReloadModule(PyObject *m) } } - reloaded_module = _PyObject_CallMethodIdObjArgs(imp, &PyId_reload, m, NULL); + reloaded_module = _PyObject_CallMethodIdOneArg(imp, &PyId_reload, m); Py_DECREF(imp); return reloaded_module; } diff --git a/Python/marshal.c b/Python/marshal.c index b2daff2c8a..cb11c8c74e 100644 --- a/Python/marshal.c +++ b/Python/marshal.c @@ -1653,7 +1653,7 @@ marshal_dump_impl(PyObject *module, PyObject *value, PyObject *file, s = PyMarshal_WriteObjectToString(value, version); if (s == NULL) return NULL; - res = _PyObject_CallMethodIdObjArgs(file, &PyId_write, s, NULL); + res = _PyObject_CallMethodIdOneArg(file, &PyId_write, s); Py_DECREF(s); return res; } diff --git a/Python/sysmodule.c b/Python/sysmodule.c index dc198a5d1e..103a111524 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -581,7 +581,7 @@ sys_displayhook_unencodable(PyThreadState *tstate, PyObject *outf, PyObject *o) buffer = _PyObject_GetAttrId(outf, &PyId_buffer); if (buffer) { - result = _PyObject_CallMethodIdObjArgs(buffer, &PyId_write, encoded, NULL); + result = _PyObject_CallMethodIdOneArg(buffer, &PyId_write, encoded); Py_DECREF(buffer); Py_DECREF(encoded); if (result == NULL) @@ -3114,9 +3114,7 @@ sys_pyfile_write_unicode(PyObject *unicode, PyObject *file) if (file == NULL) return -1; assert(unicode != NULL); - PyObject *margs[2] = {file, unicode}; - PyObject *result = _PyObject_VectorcallMethodId(&PyId_write, margs, - 2 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL); + PyObject *result = _PyObject_CallMethodIdOneArg(file, &PyId_write, unicode); if (result == NULL) { return -1; } |