mirror of
https://github.com/python/cpython.git
synced 2025-09-03 15:31:08 +00:00
Replace PyObject_CallFunction() with fastcall
Replace PyObject_CallFunction(func, "O", arg) and PyObject_CallFunction(func, "O", arg, NULL) with _PyObject_CallArg1(func, arg) Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func) _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack.
This commit is contained in:
parent
842cfff321
commit
4778eab1f2
8 changed files with 13 additions and 13 deletions
|
@ -476,7 +476,7 @@ warn_explicit(PyObject *category, PyObject *message,
|
|||
}
|
||||
else {
|
||||
text = message;
|
||||
message = PyObject_CallFunction(category, "O", message);
|
||||
message = _PyObject_CallArg1(category, message);
|
||||
if (message == NULL)
|
||||
goto cleanup;
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ PyObject *codec_makeincrementalcodec(PyObject *codec_info,
|
|||
if (errors)
|
||||
ret = PyObject_CallFunction(inccodec, "s", errors);
|
||||
else
|
||||
ret = PyObject_CallFunction(inccodec, NULL);
|
||||
ret = _PyObject_CallNoArg(inccodec);
|
||||
Py_DECREF(inccodec);
|
||||
return ret;
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ PyObject *codec_getstreamcodec(const char *encoding,
|
|||
if (errors != NULL)
|
||||
streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors);
|
||||
else
|
||||
streamcodec = PyObject_CallFunction(codeccls, "O", stream);
|
||||
streamcodec = _PyObject_CallArg1(codeccls, stream);
|
||||
Py_DECREF(codecs);
|
||||
return streamcodec;
|
||||
}
|
||||
|
|
|
@ -1274,7 +1274,7 @@ r_object(RFILE *p)
|
|||
|
||||
if (n == 0 && type == TYPE_FROZENSET) {
|
||||
/* call frozenset() to get the empty frozenset singleton */
|
||||
v = PyObject_CallFunction((PyObject*)&PyFrozenSet_Type, NULL);
|
||||
v = _PyObject_CallNoArg((PyObject*)&PyFrozenSet_Type);
|
||||
if (v == NULL)
|
||||
break;
|
||||
R_REF(v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue