mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-37547: add _PyObject_CallMethodOneArg (GH-14685)
This commit is contained in:
parent
2a3d4d9c53
commit
59ad110d7a
23 changed files with 104 additions and 93 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue