mirror of https://github.com/python/cpython
Replace PyObject_CallFunctionObjArgs() with fastcall
* PyObject_CallFunctionObjArgs(func, NULL) => _PyObject_CallNoArg(func) * PyObject_CallFunctionObjArgs(func, arg, NULL) => _PyObject_CallArg1(func, arg) PyObject_CallFunctionObjArgs() allocates 40 bytes on the C stack and requires extra work to "parse" C arguments to build a C array of PyObject*. _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack. This change is part of the fastcall project. The change on listsort() is related to the issue #23507.
This commit is contained in:
parent
8be1c39eb3
commit
27580c1fb5
|
@ -721,8 +721,7 @@ static PyObject *
|
||||||
_asyncio_Future__repr_info_impl(FutureObj *self)
|
_asyncio_Future__repr_info_impl(FutureObj *self)
|
||||||
/*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/
|
/*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/
|
||||||
{
|
{
|
||||||
return PyObject_CallFunctionObjArgs(
|
return _PyObject_CallArg1(asyncio_future_repr_info_func, self);
|
||||||
asyncio_future_repr_info_func, self, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -1535,8 +1534,7 @@ static PyObject *
|
||||||
_asyncio_Task__repr_info_impl(TaskObj *self)
|
_asyncio_Task__repr_info_impl(TaskObj *self)
|
||||||
/*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/
|
/*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/
|
||||||
{
|
{
|
||||||
return PyObject_CallFunctionObjArgs(
|
return _PyObject_CallArg1(asyncio_task_repr_info_func, self);
|
||||||
asyncio_task_repr_info_func, self, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*[clinic input]
|
/*[clinic input]
|
||||||
|
@ -1896,7 +1894,7 @@ task_set_error_soon(TaskObj *task, PyObject *et, const char *format, ...)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *e = PyObject_CallFunctionObjArgs(et, msg, NULL);
|
PyObject *e = _PyObject_CallArg1(et, msg);
|
||||||
Py_DECREF(msg);
|
Py_DECREF(msg);
|
||||||
if (e == NULL) {
|
if (e == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1946,7 +1944,7 @@ task_step_impl(TaskObj *task, PyObject *exc)
|
||||||
|
|
||||||
if (!exc) {
|
if (!exc) {
|
||||||
/* exc was not a CancelledError */
|
/* exc was not a CancelledError */
|
||||||
exc = PyObject_CallFunctionObjArgs(asyncio_CancelledError, NULL);
|
exc = _PyObject_CallNoArg(asyncio_CancelledError);
|
||||||
if (!exc) {
|
if (!exc) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -2176,7 +2174,7 @@ task_step_impl(TaskObj *task, PyObject *exc)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if `result` is a generator */
|
/* Check if `result` is a generator */
|
||||||
o = PyObject_CallFunctionObjArgs(inspect_isgenerator, result, NULL);
|
o = _PyObject_CallArg1(inspect_isgenerator, result);
|
||||||
if (o == NULL) {
|
if (o == NULL) {
|
||||||
/* An exception in inspect.isgenerator */
|
/* An exception in inspect.isgenerator */
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -1259,7 +1259,7 @@ csv_writerow(WriterObj *self, PyObject *seq)
|
||||||
(void *) self->rec, self->rec_len);
|
(void *) self->rec, self->rec_len);
|
||||||
if (line == NULL)
|
if (line == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
result = PyObject_CallFunctionObjArgs(self->writeline, line, NULL);
|
result = _PyObject_CallArg1(self->writeline, line);
|
||||||
Py_DECREF(line);
|
Py_DECREF(line);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2457,7 +2457,7 @@ treebuilder_append_event(TreeBuilderObject *self, PyObject *action,
|
||||||
PyObject *event = PyTuple_Pack(2, action, node);
|
PyObject *event = PyTuple_Pack(2, action, node);
|
||||||
if (event == NULL)
|
if (event == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
res = PyObject_CallFunctionObjArgs(self->events_append, event, NULL);
|
res = _PyObject_CallArg1(self->events_append, event);
|
||||||
Py_DECREF(event);
|
Py_DECREF(event);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -813,14 +813,14 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
|
||||||
*next_idx_ptr = idx + 1;
|
*next_idx_ptr = idx + 1;
|
||||||
|
|
||||||
if (has_pairs_hook) {
|
if (has_pairs_hook) {
|
||||||
val = PyObject_CallFunctionObjArgs(s->object_pairs_hook, rval, NULL);
|
val = _PyObject_CallArg1(s->object_pairs_hook, rval);
|
||||||
Py_DECREF(rval);
|
Py_DECREF(rval);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if object_hook is not None: rval = object_hook(rval) */
|
/* if object_hook is not None: rval = object_hook(rval) */
|
||||||
if (s->object_hook != Py_None) {
|
if (s->object_hook != Py_None) {
|
||||||
val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL);
|
val = _PyObject_CallArg1(s->object_hook, rval);
|
||||||
Py_DECREF(rval);
|
Py_DECREF(rval);
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
@ -924,7 +924,7 @@ _parse_constant(PyScannerObject *s, const char *constant, Py_ssize_t idx, Py_ssi
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* rval = parse_constant(constant) */
|
/* rval = parse_constant(constant) */
|
||||||
rval = PyObject_CallFunctionObjArgs(s->parse_constant, cstr, NULL);
|
rval = _PyObject_CallArg1(s->parse_constant, cstr);
|
||||||
idx += PyUnicode_GET_LENGTH(cstr);
|
idx += PyUnicode_GET_LENGTH(cstr);
|
||||||
Py_DECREF(cstr);
|
Py_DECREF(cstr);
|
||||||
*next_idx_ptr = idx;
|
*next_idx_ptr = idx;
|
||||||
|
@ -1023,7 +1023,7 @@ _match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_
|
||||||
idx - start);
|
idx - start);
|
||||||
if (numstr == NULL)
|
if (numstr == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
rval = PyObject_CallFunctionObjArgs(custom_func, numstr, NULL);
|
rval = _PyObject_CallArg1(custom_func, numstr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Py_ssize_t i, n;
|
Py_ssize_t i, n;
|
||||||
|
@ -1475,7 +1475,7 @@ encoder_encode_string(PyEncoderObject *s, PyObject *obj)
|
||||||
if (s->fast_encode)
|
if (s->fast_encode)
|
||||||
return s->fast_encode(NULL, obj);
|
return s->fast_encode(NULL, obj);
|
||||||
else
|
else
|
||||||
return PyObject_CallFunctionObjArgs(s->encoder, obj, NULL);
|
return _PyObject_CallArg1(s->encoder, obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -1553,7 +1553,7 @@ encoder_listencode_obj(PyEncoderObject *s, _PyAccu *acc,
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL);
|
newobj = _PyObject_CallArg1(s->defaultfn, obj);
|
||||||
if (newobj == NULL) {
|
if (newobj == NULL) {
|
||||||
Py_XDECREF(ident);
|
Py_XDECREF(ident);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -3197,7 +3197,7 @@ _password_callback(char *buf, int size, int rwflag, void *userdata)
|
||||||
PySSL_END_ALLOW_THREADS_S(pw_info->thread_state);
|
PySSL_END_ALLOW_THREADS_S(pw_info->thread_state);
|
||||||
|
|
||||||
if (pw_info->callable) {
|
if (pw_info->callable) {
|
||||||
fn_ret = PyObject_CallFunctionObjArgs(pw_info->callable, NULL);
|
fn_ret = _PyObject_CallNoArg(pw_info->callable);
|
||||||
if (!fn_ret) {
|
if (!fn_ret) {
|
||||||
/* TODO: It would be nice to move _ctypes_add_traceback() into the
|
/* TODO: It would be nice to move _ctypes_add_traceback() into the
|
||||||
core python API, so we could use it to add a frame here */
|
core python API, so we could use it to add a frame here */
|
||||||
|
|
|
@ -2046,7 +2046,7 @@ cache_struct(PyObject *fmt)
|
||||||
return s_object;
|
return s_object;
|
||||||
}
|
}
|
||||||
|
|
||||||
s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL);
|
s_object = _PyObject_CallArg1((PyObject *)(&PyStructType), fmt);
|
||||||
if (s_object != NULL) {
|
if (s_object != NULL) {
|
||||||
if (PyDict_Size(cache) >= MAXCACHE)
|
if (PyDict_Size(cache) >= MAXCACHE)
|
||||||
PyDict_Clear(cache);
|
PyDict_Clear(cache);
|
||||||
|
|
|
@ -312,7 +312,7 @@ pack_from_list(PyObject *obj, PyObject *items, PyObject *format,
|
||||||
assert(PyObject_CheckBuffer(obj));
|
assert(PyObject_CheckBuffer(obj));
|
||||||
assert(PyList_Check(items) || PyTuple_Check(items));
|
assert(PyList_Check(items) || PyTuple_Check(items));
|
||||||
|
|
||||||
structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
|
structobj = _PyObject_CallArg1(Struct, format);
|
||||||
if (structobj == NULL)
|
if (structobj == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -406,7 +406,7 @@ pack_single(char *ptr, PyObject *item, const char *fmt, Py_ssize_t itemsize)
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
|
structobj = _PyObject_CallArg1(Struct, format);
|
||||||
if (structobj == NULL)
|
if (structobj == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -620,7 +620,7 @@ unpack_rec(PyObject *unpack_from, char *ptr, PyObject *mview, char *item,
|
||||||
|
|
||||||
if (ndim == 0) {
|
if (ndim == 0) {
|
||||||
memcpy(item, ptr, itemsize);
|
memcpy(item, ptr, itemsize);
|
||||||
x = PyObject_CallFunctionObjArgs(unpack_from, mview, NULL);
|
x = _PyObject_CallArg1(unpack_from, mview);
|
||||||
if (x == NULL)
|
if (x == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (PyTuple_GET_SIZE(x) == 1) {
|
if (PyTuple_GET_SIZE(x) == 1) {
|
||||||
|
@ -696,7 +696,7 @@ ndarray_as_list(NDArrayObject *nd)
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
|
structobj = _PyObject_CallArg1(Struct, format);
|
||||||
Py_DECREF(format);
|
Py_DECREF(format);
|
||||||
if (structobj == NULL)
|
if (structobj == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -788,7 +788,7 @@ get_itemsize(PyObject *format)
|
||||||
PyObject *tmp;
|
PyObject *tmp;
|
||||||
Py_ssize_t itemsize;
|
Py_ssize_t itemsize;
|
||||||
|
|
||||||
tmp = PyObject_CallFunctionObjArgs(calcsize, format, NULL);
|
tmp = _PyObject_CallArg1(calcsize, format);
|
||||||
if (tmp == NULL)
|
if (tmp == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
itemsize = PyLong_AsSsize_t(tmp);
|
itemsize = PyLong_AsSsize_t(tmp);
|
||||||
|
|
|
@ -709,7 +709,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
||||||
assert(callback != NULL);
|
assert(callback != NULL);
|
||||||
|
|
||||||
/* copy-paste of weakrefobject.c's handle_callback() */
|
/* copy-paste of weakrefobject.c's handle_callback() */
|
||||||
temp = PyObject_CallFunctionObjArgs(callback, wr, NULL);
|
temp = _PyObject_CallArg1(callback, wr);
|
||||||
if (temp == NULL)
|
if (temp == NULL)
|
||||||
PyErr_WriteUnraisable(callback);
|
PyErr_WriteUnraisable(callback);
|
||||||
else
|
else
|
||||||
|
|
|
@ -101,7 +101,7 @@ groupby_next(groupbyobject *gbo)
|
||||||
newkey = newvalue;
|
newkey = newvalue;
|
||||||
Py_INCREF(newvalue);
|
Py_INCREF(newvalue);
|
||||||
} else {
|
} else {
|
||||||
newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL);
|
newkey = _PyObject_CallArg1(gbo->keyfunc, newvalue);
|
||||||
if (newkey == NULL) {
|
if (newkey == NULL) {
|
||||||
Py_DECREF(newvalue);
|
Py_DECREF(newvalue);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -293,7 +293,7 @@ _grouper_next(_grouperobject *igo)
|
||||||
newkey = newvalue;
|
newkey = newvalue;
|
||||||
Py_INCREF(newvalue);
|
Py_INCREF(newvalue);
|
||||||
} else {
|
} else {
|
||||||
newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL);
|
newkey = _PyObject_CallArg1(gbo->keyfunc, newvalue);
|
||||||
if (newkey == NULL) {
|
if (newkey == NULL) {
|
||||||
Py_DECREF(newvalue);
|
Py_DECREF(newvalue);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1130,7 +1130,7 @@ dropwhile_next(dropwhileobject *lz)
|
||||||
if (lz->start == 1)
|
if (lz->start == 1)
|
||||||
return item;
|
return item;
|
||||||
|
|
||||||
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
|
good = _PyObject_CallArg1(lz->func, item);
|
||||||
if (good == NULL) {
|
if (good == NULL) {
|
||||||
Py_DECREF(item);
|
Py_DECREF(item);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1296,7 +1296,7 @@ takewhile_next(takewhileobject *lz)
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
|
good = _PyObject_CallArg1(lz->func, item);
|
||||||
if (good == NULL) {
|
if (good == NULL) {
|
||||||
Py_DECREF(item);
|
Py_DECREF(item);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -3824,7 +3824,7 @@ filterfalse_next(filterfalseobject *lz)
|
||||||
ok = PyObject_IsTrue(item);
|
ok = PyObject_IsTrue(item);
|
||||||
} else {
|
} else {
|
||||||
PyObject *good;
|
PyObject *good;
|
||||||
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
|
good = _PyObject_CallArg1(lz->func, item);
|
||||||
if (good == NULL) {
|
if (good == NULL) {
|
||||||
Py_DECREF(item);
|
Py_DECREF(item);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -951,7 +951,7 @@ static PyObject * math_ceil(PyObject *self, PyObject *number) {
|
||||||
return NULL;
|
return NULL;
|
||||||
return math_1_to_int(number, ceil, 0);
|
return math_1_to_int(number, ceil, 0);
|
||||||
}
|
}
|
||||||
result = PyObject_CallFunctionObjArgs(method, NULL);
|
result = _PyObject_CallNoArg(method);
|
||||||
Py_DECREF(method);
|
Py_DECREF(method);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -991,7 +991,7 @@ static PyObject * math_floor(PyObject *self, PyObject *number) {
|
||||||
return NULL;
|
return NULL;
|
||||||
return math_1_to_int(number, floor, 0);
|
return math_1_to_int(number, floor, 0);
|
||||||
}
|
}
|
||||||
result = PyObject_CallFunctionObjArgs(method, NULL);
|
result = _PyObject_CallNoArg(method);
|
||||||
Py_DECREF(method);
|
Py_DECREF(method);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1542,7 +1542,7 @@ math_trunc(PyObject *self, PyObject *number)
|
||||||
Py_TYPE(number)->tp_name);
|
Py_TYPE(number)->tp_name);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
result = PyObject_CallFunctionObjArgs(trunc, NULL);
|
result = _PyObject_CallNoArg(trunc);
|
||||||
Py_DECREF(trunc);
|
Py_DECREF(trunc);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -902,7 +902,7 @@ path_converter(PyObject *o, void *p)
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
o = to_cleanup = PyObject_CallFunctionObjArgs(func, NULL);
|
o = to_cleanup = _PyObject_CallNoArg(func);
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
if (NULL == o) {
|
if (NULL == o) {
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
@ -12041,7 +12041,7 @@ PyOS_FSPath(PyObject *path)
|
||||||
Py_TYPE(path)->tp_name);
|
Py_TYPE(path)->tp_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
path_repr = PyObject_CallFunctionObjArgs(func, NULL);
|
path_repr = _PyObject_CallNoArg(func);
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
if (NULL == path_repr) {
|
if (NULL == path_repr) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -103,7 +103,7 @@ PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue)
|
||||||
}
|
}
|
||||||
return defaultvalue;
|
return defaultvalue;
|
||||||
}
|
}
|
||||||
result = PyObject_CallFunctionObjArgs(hint, NULL);
|
result = _PyObject_CallNoArg(hint);
|
||||||
Py_DECREF(hint);
|
Py_DECREF(hint);
|
||||||
if (result == NULL) {
|
if (result == NULL) {
|
||||||
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
|
if (PyErr_ExceptionMatches(PyExc_TypeError)) {
|
||||||
|
@ -716,7 +716,7 @@ PyObject_Format(PyObject *obj, PyObject *format_spec)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* And call it. */
|
/* And call it. */
|
||||||
result = PyObject_CallFunctionObjArgs(meth, format_spec, NULL);
|
result = _PyObject_CallArg1(meth, format_spec);
|
||||||
Py_DECREF(meth);
|
Py_DECREF(meth);
|
||||||
|
|
||||||
if (result && !PyUnicode_Check(result)) {
|
if (result && !PyUnicode_Check(result)) {
|
||||||
|
@ -3011,7 +3011,7 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls)
|
||||||
Py_DECREF(checker);
|
Py_DECREF(checker);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
res = PyObject_CallFunctionObjArgs(checker, inst, NULL);
|
res = _PyObject_CallArg1(checker, inst);
|
||||||
Py_LeaveRecursiveCall();
|
Py_LeaveRecursiveCall();
|
||||||
Py_DECREF(checker);
|
Py_DECREF(checker);
|
||||||
if (res != NULL) {
|
if (res != NULL) {
|
||||||
|
@ -3085,7 +3085,7 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls)
|
||||||
Py_DECREF(checker);
|
Py_DECREF(checker);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
res = PyObject_CallFunctionObjArgs(checker, derived, NULL);
|
res = _PyObject_CallArg1(checker, derived);
|
||||||
Py_LeaveRecursiveCall();
|
Py_LeaveRecursiveCall();
|
||||||
Py_DECREF(checker);
|
Py_DECREF(checker);
|
||||||
if (res != NULL) {
|
if (res != NULL) {
|
||||||
|
|
|
@ -98,8 +98,7 @@ _canresize(PyByteArrayObject *self)
|
||||||
PyObject *
|
PyObject *
|
||||||
PyByteArray_FromObject(PyObject *input)
|
PyByteArray_FromObject(PyObject *input)
|
||||||
{
|
{
|
||||||
return PyObject_CallFunctionObjArgs((PyObject *)&PyByteArray_Type,
|
return _PyObject_CallArg1((PyObject *)&PyByteArray_Type, input);
|
||||||
input, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
|
@ -1985,8 +1984,7 @@ bytearray_fromhex_impl(PyTypeObject *type, PyObject *string)
|
||||||
{
|
{
|
||||||
PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type);
|
PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type);
|
||||||
if (type != &PyByteArray_Type && result != NULL) {
|
if (type != &PyByteArray_Type && result != NULL) {
|
||||||
Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type,
|
Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result));
|
||||||
result, NULL));
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -549,7 +549,7 @@ format_obj(PyObject *v, const char **pbuf, Py_ssize_t *plen)
|
||||||
/* does it support __bytes__? */
|
/* does it support __bytes__? */
|
||||||
func = _PyObject_LookupSpecial(v, &PyId___bytes__);
|
func = _PyObject_LookupSpecial(v, &PyId___bytes__);
|
||||||
if (func != NULL) {
|
if (func != NULL) {
|
||||||
result = PyObject_CallFunctionObjArgs(func, NULL);
|
result = _PyObject_CallNoArg(func);
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -2331,8 +2331,7 @@ bytes_fromhex_impl(PyTypeObject *type, PyObject *string)
|
||||||
{
|
{
|
||||||
PyObject *result = _PyBytes_FromHex(string, 0);
|
PyObject *result = _PyBytes_FromHex(string, 0);
|
||||||
if (type != &PyBytes_Type && result != NULL) {
|
if (type != &PyBytes_Type && result != NULL) {
|
||||||
Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type,
|
Py_SETREF(result, _PyObject_CallArg1((PyObject *)type, result));
|
||||||
result, NULL));
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -2569,7 +2568,7 @@ bytes_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
PyObject_Bytes doesn't do. */
|
PyObject_Bytes doesn't do. */
|
||||||
func = _PyObject_LookupSpecial(x, &PyId___bytes__);
|
func = _PyObject_LookupSpecial(x, &PyId___bytes__);
|
||||||
if (func != NULL) {
|
if (func != NULL) {
|
||||||
new = PyObject_CallFunctionObjArgs(func, NULL);
|
new = _PyObject_CallNoArg(func);
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
if (new == NULL)
|
if (new == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -273,7 +273,7 @@ try_complex_special_method(PyObject *op) {
|
||||||
|
|
||||||
f = _PyObject_LookupSpecial(op, &PyId___complex__);
|
f = _PyObject_LookupSpecial(op, &PyId___complex__);
|
||||||
if (f) {
|
if (f) {
|
||||||
PyObject *res = PyObject_CallFunctionObjArgs(f, NULL);
|
PyObject *res = _PyObject_CallNoArg(f);
|
||||||
Py_DECREF(f);
|
Py_DECREF(f);
|
||||||
if (res != NULL && !PyComplex_Check(res)) {
|
if (res != NULL && !PyComplex_Check(res)) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
|
|
|
@ -1414,7 +1414,7 @@ property_descr_set(PyObject *self, PyObject *obj, PyObject *value)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
res = PyObject_CallFunctionObjArgs(func, obj, NULL);
|
res = _PyObject_CallArg1(func, obj);
|
||||||
else
|
else
|
||||||
res = PyObject_CallFunctionObjArgs(func, obj, value, NULL);
|
res = PyObject_CallFunctionObjArgs(func, obj, value, NULL);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
|
|
|
@ -2066,8 +2066,7 @@ dict_subscript(PyDictObject *mp, PyObject *key)
|
||||||
_Py_IDENTIFIER(__missing__);
|
_Py_IDENTIFIER(__missing__);
|
||||||
missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__);
|
missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__);
|
||||||
if (missing != NULL) {
|
if (missing != NULL) {
|
||||||
res = PyObject_CallFunctionObjArgs(missing,
|
res = _PyObject_CallArg1(missing, key);
|
||||||
key, NULL);
|
|
||||||
Py_DECREF(missing);
|
Py_DECREF(missing);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,7 +258,7 @@ reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (reversed_meth != NULL) {
|
if (reversed_meth != NULL) {
|
||||||
PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL);
|
PyObject *res = _PyObject_CallNoArg(reversed_meth);
|
||||||
Py_DECREF(reversed_meth);
|
Py_DECREF(reversed_meth);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1439,7 +1439,7 @@ float_fromhex(PyObject *cls, PyObject *arg)
|
||||||
goto parse_error;
|
goto parse_error;
|
||||||
result = PyFloat_FromDouble(negate ? -x : x);
|
result = PyFloat_FromDouble(negate ? -x : x);
|
||||||
if (cls != (PyObject *)&PyFloat_Type && result != NULL) {
|
if (cls != (PyObject *)&PyFloat_Type && result != NULL) {
|
||||||
Py_SETREF(result, PyObject_CallFunctionObjArgs(cls, result, NULL));
|
Py_SETREF(result, _PyObject_CallArg1(cls, result));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ _PyGen_Finalize(PyObject *self)
|
||||||
/* Save the current exception, if any. */
|
/* Save the current exception, if any. */
|
||||||
PyErr_Fetch(&error_type, &error_value, &error_traceback);
|
PyErr_Fetch(&error_type, &error_value, &error_traceback);
|
||||||
|
|
||||||
res = PyObject_CallFunctionObjArgs(finalizer, self, NULL);
|
res = _PyObject_CallArg1(finalizer, self);
|
||||||
|
|
||||||
if (res == NULL) {
|
if (res == NULL) {
|
||||||
PyErr_WriteUnraisable(self);
|
PyErr_WriteUnraisable(self);
|
||||||
|
@ -591,7 +591,7 @@ _PyGen_SetStopIterationValue(PyObject *value)
|
||||||
*
|
*
|
||||||
* (See PyErr_SetObject/_PyErr_CreateException code for details.)
|
* (See PyErr_SetObject/_PyErr_CreateException code for details.)
|
||||||
*/
|
*/
|
||||||
e = PyObject_CallFunctionObjArgs(PyExc_StopIteration, value, NULL);
|
e = _PyObject_CallArg1(PyExc_StopIteration, value);
|
||||||
if (e == NULL) {
|
if (e == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1970,8 +1970,7 @@ listsort(PyListObject *self, PyObject *args, PyObject *kwds)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < saved_ob_size ; i++) {
|
for (i = 0; i < saved_ob_size ; i++) {
|
||||||
keys[i] = PyObject_CallFunctionObjArgs(keyfunc, saved_ob_item[i],
|
keys[i] = _PyObject_CallArg1(keyfunc, saved_ob_item[i]);
|
||||||
NULL);
|
|
||||||
if (keys[i] == NULL) {
|
if (keys[i] == NULL) {
|
||||||
for (i=i-1 ; i>=0 ; i--)
|
for (i=i-1 ; i>=0 ; i--)
|
||||||
Py_DECREF(keys[i]);
|
Py_DECREF(keys[i]);
|
||||||
|
|
|
@ -5282,8 +5282,7 @@ long_from_bytes(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
Py_DECREF(bytes);
|
Py_DECREF(bytes);
|
||||||
|
|
||||||
if (type != &PyLong_Type) {
|
if (type != &PyLong_Type) {
|
||||||
Py_SETREF(long_obj, PyObject_CallFunctionObjArgs((PyObject *)type,
|
Py_SETREF(long_obj, _PyObject_CallArg1((PyObject *)type, long_obj));
|
||||||
long_obj, NULL));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return long_obj;
|
return long_obj;
|
||||||
|
|
|
@ -1939,7 +1939,7 @@ struct_get_unpacker(const char *fmt, Py_ssize_t itemsize)
|
||||||
if (format == NULL)
|
if (format == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
|
structobj = _PyObject_CallArg1(Struct, format);
|
||||||
if (structobj == NULL)
|
if (structobj == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
|
@ -1978,7 +1978,7 @@ struct_unpack_single(const char *ptr, struct unpacker *x)
|
||||||
PyObject *v;
|
PyObject *v;
|
||||||
|
|
||||||
memcpy(x->item, ptr, x->itemsize);
|
memcpy(x->item, ptr, x->itemsize);
|
||||||
v = PyObject_CallFunctionObjArgs(x->unpack_from, x->mview, NULL);
|
v = _PyObject_CallArg1(x->unpack_from, x->mview);
|
||||||
if (v == NULL)
|
if (v == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -596,7 +596,7 @@ PyObject_Bytes(PyObject *v)
|
||||||
|
|
||||||
func = _PyObject_LookupSpecial(v, &PyId___bytes__);
|
func = _PyObject_LookupSpecial(v, &PyId___bytes__);
|
||||||
if (func != NULL) {
|
if (func != NULL) {
|
||||||
result = PyObject_CallFunctionObjArgs(func, NULL);
|
result = _PyObject_CallNoArg(func);
|
||||||
Py_DECREF(func);
|
Py_DECREF(func);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1314,7 +1314,7 @@ _dir_object(PyObject *obj)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/* use __dir__ */
|
/* use __dir__ */
|
||||||
result = PyObject_CallFunctionObjArgs(dirfunc, NULL);
|
result = _PyObject_CallNoArg(dirfunc);
|
||||||
Py_DECREF(dirfunc);
|
Py_DECREF(dirfunc);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1256,7 +1256,7 @@ odict_copy(register PyODictObject *od)
|
||||||
if (PyODict_CheckExact(od))
|
if (PyODict_CheckExact(od))
|
||||||
od_copy = PyODict_New();
|
od_copy = PyODict_New();
|
||||||
else
|
else
|
||||||
od_copy = PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(od), NULL);
|
od_copy = _PyObject_CallNoArg((PyObject *)Py_TYPE(od));
|
||||||
if (od_copy == NULL)
|
if (od_copy == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -3487,9 +3487,7 @@ object_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
|
||||||
sorted = _PyDict_GetItemId(builtins, &PyId_sorted);
|
sorted = _PyDict_GetItemId(builtins, &PyId_sorted);
|
||||||
if (sorted == NULL)
|
if (sorted == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
sorted_methods = PyObject_CallFunctionObjArgs(sorted,
|
sorted_methods = _PyObject_CallArg1(sorted, abstract_methods);
|
||||||
abstract_methods,
|
|
||||||
NULL);
|
|
||||||
if (sorted_methods == NULL)
|
if (sorted_methods == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
comma = _PyUnicode_FromId(&comma_id);
|
comma = _PyUnicode_FromId(&comma_id);
|
||||||
|
@ -6193,7 +6191,7 @@ call_attribute(PyObject *self, PyObject *attr, PyObject *name)
|
||||||
else
|
else
|
||||||
attr = descr;
|
attr = descr;
|
||||||
}
|
}
|
||||||
res = PyObject_CallFunctionObjArgs(attr, name, NULL);
|
res = _PyObject_CallArg1(attr, name);
|
||||||
Py_XDECREF(descr);
|
Py_XDECREF(descr);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4269,7 +4269,7 @@ unicode_decode_call_errorhandler_wchar(
|
||||||
if (*exceptionObject == NULL)
|
if (*exceptionObject == NULL)
|
||||||
goto onError;
|
goto onError;
|
||||||
|
|
||||||
restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL);
|
restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
|
||||||
if (restuple == NULL)
|
if (restuple == NULL)
|
||||||
goto onError;
|
goto onError;
|
||||||
if (!PyTuple_Check(restuple)) {
|
if (!PyTuple_Check(restuple)) {
|
||||||
|
@ -4368,7 +4368,7 @@ unicode_decode_call_errorhandler_writer(
|
||||||
if (*exceptionObject == NULL)
|
if (*exceptionObject == NULL)
|
||||||
goto onError;
|
goto onError;
|
||||||
|
|
||||||
restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL);
|
restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
|
||||||
if (restuple == NULL)
|
if (restuple == NULL)
|
||||||
goto onError;
|
goto onError;
|
||||||
if (!PyTuple_Check(restuple)) {
|
if (!PyTuple_Check(restuple)) {
|
||||||
|
@ -6649,8 +6649,7 @@ unicode_encode_call_errorhandler(const char *errors,
|
||||||
if (*exceptionObject == NULL)
|
if (*exceptionObject == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
restuple = PyObject_CallFunctionObjArgs(
|
restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
|
||||||
*errorHandler, *exceptionObject, NULL);
|
|
||||||
if (restuple == NULL)
|
if (restuple == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!PyTuple_Check(restuple)) {
|
if (!PyTuple_Check(restuple)) {
|
||||||
|
@ -8644,8 +8643,7 @@ unicode_translate_call_errorhandler(const char *errors,
|
||||||
if (*exceptionObject == NULL)
|
if (*exceptionObject == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
restuple = PyObject_CallFunctionObjArgs(
|
restuple = _PyObject_CallArg1(*errorHandler, *exceptionObject);
|
||||||
*errorHandler, *exceptionObject, NULL);
|
|
||||||
if (restuple == NULL)
|
if (restuple == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!PyTuple_Check(restuple)) {
|
if (!PyTuple_Check(restuple)) {
|
||||||
|
|
|
@ -867,7 +867,7 @@ PyWeakref_GetObject(PyObject *ref)
|
||||||
static void
|
static void
|
||||||
handle_callback(PyWeakReference *ref, PyObject *callback)
|
handle_callback(PyWeakReference *ref, PyObject *callback)
|
||||||
{
|
{
|
||||||
PyObject *cbresult = PyObject_CallFunctionObjArgs(callback, ref, NULL);
|
PyObject *cbresult = _PyObject_CallArg1(callback, ref);
|
||||||
|
|
||||||
if (cbresult == NULL)
|
if (cbresult == NULL)
|
||||||
PyErr_WriteUnraisable(callback);
|
PyErr_WriteUnraisable(callback);
|
||||||
|
|
|
@ -415,7 +415,7 @@ call_show_warning(PyObject *category, PyObject *text, PyObject *message,
|
||||||
if (msg == NULL)
|
if (msg == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
res = PyObject_CallFunctionObjArgs(show_fn, msg, NULL);
|
res = _PyObject_CallArg1(show_fn, msg);
|
||||||
Py_DECREF(show_fn);
|
Py_DECREF(show_fn);
|
||||||
Py_DECREF(msg);
|
Py_DECREF(msg);
|
||||||
|
|
||||||
|
|
|
@ -469,7 +469,7 @@ filter_next(filterobject *lz)
|
||||||
ok = PyObject_IsTrue(item);
|
ok = PyObject_IsTrue(item);
|
||||||
} else {
|
} else {
|
||||||
PyObject *good;
|
PyObject *good;
|
||||||
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
|
good = _PyObject_CallArg1(lz->func, item);
|
||||||
if (good == NULL) {
|
if (good == NULL) {
|
||||||
Py_DECREF(item);
|
Py_DECREF(item);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1519,7 +1519,7 @@ min_max(PyObject *args, PyObject *kwds, int op)
|
||||||
while (( item = PyIter_Next(it) )) {
|
while (( item = PyIter_Next(it) )) {
|
||||||
/* get the value from the key function */
|
/* get the value from the key function */
|
||||||
if (keyfunc != NULL) {
|
if (keyfunc != NULL) {
|
||||||
val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL);
|
val = _PyObject_CallArg1(keyfunc, item);
|
||||||
if (val == NULL)
|
if (val == NULL)
|
||||||
goto Fail_it_item;
|
goto Fail_it_item;
|
||||||
}
|
}
|
||||||
|
@ -2044,9 +2044,9 @@ builtin_round(PyObject *self, PyObject *args, PyObject *kwds)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ndigits == NULL || ndigits == Py_None)
|
if (ndigits == NULL || ndigits == Py_None)
|
||||||
result = PyObject_CallFunctionObjArgs(round, NULL);
|
result = _PyObject_CallNoArg(round);
|
||||||
else
|
else
|
||||||
result = PyObject_CallFunctionObjArgs(round, ndigits, NULL);
|
result = _PyObject_CallArg1(round, ndigits);
|
||||||
Py_DECREF(round);
|
Py_DECREF(round);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1756,7 +1756,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
res = PyObject_CallFunctionObjArgs(hook, value, NULL);
|
res = _PyObject_CallArg1(hook, value);
|
||||||
Py_DECREF(value);
|
Py_DECREF(value);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -3062,7 +3062,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
|
||||||
Py_DECREF(mgr);
|
Py_DECREF(mgr);
|
||||||
if (enter == NULL)
|
if (enter == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
res = PyObject_CallFunctionObjArgs(enter, NULL);
|
res = _PyObject_CallNoArg(enter);
|
||||||
Py_DECREF(enter);
|
Py_DECREF(enter);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
@ -3096,7 +3096,7 @@ _PyEval_EvalFrameDefault(PyFrameObject *f, int throwflag)
|
||||||
}
|
}
|
||||||
SET_TOP(exit);
|
SET_TOP(exit);
|
||||||
Py_DECREF(mgr);
|
Py_DECREF(mgr);
|
||||||
res = PyObject_CallFunctionObjArgs(enter, NULL);
|
res = _PyObject_CallNoArg(enter);
|
||||||
Py_DECREF(enter);
|
Py_DECREF(enter);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -985,7 +985,7 @@ get_path_importer(PyObject *path_importer_cache, PyObject *path_hooks,
|
||||||
PyObject *hook = PyList_GetItem(path_hooks, j);
|
PyObject *hook = PyList_GetItem(path_hooks, j);
|
||||||
if (hook == NULL)
|
if (hook == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
importer = PyObject_CallFunctionObjArgs(hook, p, NULL);
|
importer = _PyObject_CallArg1(hook, p);
|
||||||
if (importer != NULL)
|
if (importer != NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1098,7 +1098,7 @@ _PySys_GetSizeOf(PyObject *o)
|
||||||
Py_TYPE(o)->tp_name);
|
Py_TYPE(o)->tp_name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
res = PyObject_CallFunctionObjArgs(method, NULL);
|
res = _PyObject_CallNoArg(method);
|
||||||
Py_DECREF(method);
|
Py_DECREF(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue