From 4778eab1f2b70cd2431252cae987e4adb3729ce8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 1 Dec 2016 14:51:04 +0100 Subject: 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. --- Python/codecs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Python/codecs.c') diff --git a/Python/codecs.c b/Python/codecs.c index bf152c2e56f..55f6ca85e3c 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -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; } -- cgit v1.2.3