mirror of https://github.com/python/cpython
bpo-37483: add _PyObject_CallOneArg() function (#14558)
This commit is contained in:
parent
9d40554e0d
commit
196a530e00
|
@ -264,6 +264,17 @@ Object Protocol
|
|||
.. versionadded:: 3.9
|
||||
|
||||
|
||||
.. c:function:: PyObject* _PyObject_CallOneArg(PyObject *callable, PyObject *arg)
|
||||
|
||||
Call a callable Python object *callable* with exactly 1 positional argument
|
||||
*arg* and no keyword arguments.
|
||||
|
||||
Return the result of the call on success, or raise an exception and return
|
||||
*NULL* on failure.
|
||||
|
||||
.. versionadded:: 3.9
|
||||
|
||||
|
||||
.. c:function:: PyObject* PyObject_Call(PyObject *callable, PyObject *args, PyObject *kwargs)
|
||||
|
||||
Call a callable Python object *callable*, with arguments given by the
|
||||
|
|
|
@ -62,6 +62,7 @@ PyVectorcall_NARGS(size_t n)
|
|||
static inline vectorcallfunc
|
||||
_PyVectorcall_Function(PyObject *callable)
|
||||
{
|
||||
assert(callable != NULL);
|
||||
PyTypeObject *tp = Py_TYPE(callable);
|
||||
if (!PyType_HasFeature(tp, _Py_TPFLAGS_HAVE_VECTORCALL)) {
|
||||
return NULL;
|
||||
|
@ -134,6 +135,17 @@ _PyObject_CallNoArg(PyObject *func) {
|
|||
return _PyObject_Vectorcall(func, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
static inline PyObject *
|
||||
_PyObject_CallOneArg(PyObject *func, PyObject *arg)
|
||||
{
|
||||
assert(arg != NULL);
|
||||
PyObject *_args[2];
|
||||
PyObject **args = _args + 1; // For PY_VECTORCALL_ARGUMENTS_OFFSET
|
||||
args[0] = arg;
|
||||
return _PyObject_Vectorcall(func, args,
|
||||
1 | PY_VECTORCALL_ARGUMENTS_OFFSET, NULL);
|
||||
}
|
||||
|
||||
PyAPI_FUNC(PyObject *) _PyObject_Call_Prepend(
|
||||
PyObject *callable,
|
||||
PyObject *obj,
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
Add new function ``_PyObject_CallOneArg`` for calling an object with one
|
||||
positional argument.
|
|
@ -141,8 +141,7 @@ _is_coroutine(PyObject *coro)
|
|||
Do this check after 'future_init()'; in case we need to raise
|
||||
an error, __del__ needs a properly initialized object.
|
||||
*/
|
||||
PyObject *res = PyObject_CallFunctionObjArgs(
|
||||
asyncio_iscoroutine_func, coro, NULL);
|
||||
PyObject *res = _PyObject_CallOneArg(asyncio_iscoroutine_func, coro);
|
||||
if (res == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1286,8 +1285,7 @@ static PyObject *
|
|||
_asyncio_Future__repr_info_impl(FutureObj *self)
|
||||
/*[clinic end generated code: output=fa69e901bd176cfb input=f21504d8e2ae1ca2]*/
|
||||
{
|
||||
return PyObject_CallFunctionObjArgs(
|
||||
asyncio_future_repr_info_func, self, NULL);
|
||||
return _PyObject_CallOneArg(asyncio_future_repr_info_func, (PyObject *)self);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -1364,7 +1362,7 @@ FutureObj_finalize(FutureObj *fut)
|
|||
|
||||
func = _PyObject_GetAttrId(fut->fut_loop, &PyId_call_exception_handler);
|
||||
if (func != NULL) {
|
||||
PyObject *res = PyObject_CallFunctionObjArgs(func, context, NULL);
|
||||
PyObject *res = _PyObject_CallOneArg(func, context);
|
||||
if (res == NULL) {
|
||||
PyErr_WriteUnraisable(func);
|
||||
}
|
||||
|
@ -2104,13 +2102,13 @@ _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop)
|
|||
Py_DECREF(current_task_func);
|
||||
return NULL;
|
||||
}
|
||||
ret = PyObject_CallFunctionObjArgs(current_task_func, loop, NULL);
|
||||
ret = _PyObject_CallOneArg(current_task_func, loop);
|
||||
Py_DECREF(current_task_func);
|
||||
Py_DECREF(loop);
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
ret = PyObject_CallFunctionObjArgs(current_task_func, loop, NULL);
|
||||
ret = _PyObject_CallOneArg(current_task_func, loop);
|
||||
Py_DECREF(current_task_func);
|
||||
return ret;
|
||||
}
|
||||
|
@ -2146,7 +2144,7 @@ _asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
res = PyObject_CallFunctionObjArgs(all_tasks_func, loop, NULL);
|
||||
res = _PyObject_CallOneArg(all_tasks_func, loop);
|
||||
Py_DECREF(all_tasks_func);
|
||||
return res;
|
||||
}
|
||||
|
@ -2159,8 +2157,7 @@ static PyObject *
|
|||
_asyncio_Task__repr_info_impl(TaskObj *self)
|
||||
/*[clinic end generated code: output=6a490eb66d5ba34b input=3c6d051ed3ddec8b]*/
|
||||
{
|
||||
return PyObject_CallFunctionObjArgs(
|
||||
asyncio_task_repr_info_func, self, NULL);
|
||||
return _PyObject_CallOneArg(asyncio_task_repr_info_func, (PyObject *)self);
|
||||
}
|
||||
|
||||
/*[clinic input]
|
||||
|
@ -2411,7 +2408,7 @@ TaskObj_finalize(TaskObj *task)
|
|||
|
||||
func = _PyObject_GetAttrId(task->task_loop, &PyId_call_exception_handler);
|
||||
if (func != NULL) {
|
||||
PyObject *res = PyObject_CallFunctionObjArgs(func, context, NULL);
|
||||
PyObject *res = _PyObject_CallOneArg(func, context);
|
||||
if (res == NULL) {
|
||||
PyErr_WriteUnraisable(func);
|
||||
}
|
||||
|
@ -2543,7 +2540,7 @@ task_set_error_soon(TaskObj *task, PyObject *et, const char *format, ...)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
PyObject *e = PyObject_CallFunctionObjArgs(et, msg, NULL);
|
||||
PyObject *e = _PyObject_CallOneArg(et, msg);
|
||||
Py_DECREF(msg);
|
||||
if (e == NULL) {
|
||||
return NULL;
|
||||
|
|
|
@ -512,8 +512,7 @@ deque_copy(PyObject *deque, PyObject *Py_UNUSED(ignored))
|
|||
return NULL;
|
||||
}
|
||||
if (old_deque->maxlen < 0)
|
||||
result = PyObject_CallFunctionObjArgs((PyObject *)(Py_TYPE(deque)),
|
||||
deque, NULL);
|
||||
result = _PyObject_CallOneArg((PyObject *)(Py_TYPE(deque)), deque);
|
||||
else
|
||||
result = PyObject_CallFunction((PyObject *)(Py_TYPE(deque)), "Oi",
|
||||
deque, old_deque->maxlen, NULL);
|
||||
|
|
|
@ -1240,7 +1240,7 @@ csv_writerow(WriterObj *self, PyObject *seq)
|
|||
if (line == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
result = PyObject_CallFunctionObjArgs(self->write, line, NULL);
|
||||
result = _PyObject_CallOneArg(self->write, line);
|
||||
Py_DECREF(line);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -925,7 +925,7 @@ static PyObject *GetResult(PyObject *restype, void *result, PyObject *checker)
|
|||
if (!checker || !retval)
|
||||
return retval;
|
||||
|
||||
v = PyObject_CallFunctionObjArgs(checker, retval, NULL);
|
||||
v = _PyObject_CallOneArg(checker, retval);
|
||||
if (v == NULL)
|
||||
_PyTraceback_Add("GetResult", "_ctypes/callproc.c", __LINE__-2);
|
||||
Py_DECREF(retval);
|
||||
|
@ -1118,7 +1118,7 @@ PyObject *_ctypes_callproc(PPROC pProc,
|
|||
if (argtypes && argtype_count > i) {
|
||||
PyObject *v;
|
||||
converter = PyTuple_GET_ITEM(argtypes, i);
|
||||
v = PyObject_CallFunctionObjArgs(converter, arg, NULL);
|
||||
v = _PyObject_CallOneArg(converter, arg);
|
||||
if (v == NULL) {
|
||||
_ctypes_extend_error(PyExc_ArgError, "argument %zd: ", i+1);
|
||||
goto cleanup;
|
||||
|
@ -1795,7 +1795,7 @@ pointer(PyObject *self, PyObject *arg)
|
|||
|
||||
typ = PyDict_GetItemWithError(_ctypes_ptrtype_cache, (PyObject *)Py_TYPE(arg));
|
||||
if (typ) {
|
||||
return PyObject_CallFunctionObjArgs(typ, arg, NULL);
|
||||
return _PyObject_CallOneArg(typ, arg);
|
||||
}
|
||||
else if (PyErr_Occurred()) {
|
||||
return NULL;
|
||||
|
@ -1803,7 +1803,7 @@ pointer(PyObject *self, PyObject *arg)
|
|||
typ = POINTER(NULL, (PyObject *)Py_TYPE(arg));
|
||||
if (typ == NULL)
|
||||
return NULL;
|
||||
result = PyObject_CallFunctionObjArgs(typ, arg, NULL);
|
||||
result = _PyObject_CallOneArg(typ, arg);
|
||||
Py_DECREF(typ);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -2696,7 +2696,7 @@ treebuilder_append_event(TreeBuilderObject *self, PyObject *action,
|
|||
PyObject *event = PyTuple_Pack(2, action, node);
|
||||
if (event == NULL)
|
||||
return -1;
|
||||
res = _PyObject_FastCall(self->events_append, &event, 1);
|
||||
res = _PyObject_CallOneArg(self->events_append, event);
|
||||
Py_DECREF(event);
|
||||
if (res == NULL)
|
||||
return -1;
|
||||
|
@ -2859,7 +2859,7 @@ treebuilder_handle_comment(TreeBuilderObject* self, PyObject* text)
|
|||
}
|
||||
|
||||
if (self->comment_factory) {
|
||||
comment = _PyObject_FastCall(self->comment_factory, &text, 1);
|
||||
comment = _PyObject_CallOneArg(self->comment_factory, text);
|
||||
if (!comment)
|
||||
return NULL;
|
||||
|
||||
|
@ -3197,7 +3197,7 @@ expat_set_error(enum XML_Error error_code, Py_ssize_t line, Py_ssize_t column,
|
|||
if (errmsg == NULL)
|
||||
return;
|
||||
|
||||
error = _PyObject_FastCall(st->parseerror_obj, &errmsg, 1);
|
||||
error = _PyObject_CallOneArg(st->parseerror_obj, errmsg);
|
||||
Py_DECREF(errmsg);
|
||||
if (!error)
|
||||
return;
|
||||
|
@ -3260,7 +3260,7 @@ expat_default_handler(XMLParserObject* self, const XML_Char* data_in,
|
|||
(TreeBuilderObject*) self->target, value
|
||||
);
|
||||
else if (self->handle_data)
|
||||
res = _PyObject_FastCall(self->handle_data, &value, 1);
|
||||
res = _PyObject_CallOneArg(self->handle_data, value);
|
||||
else
|
||||
res = NULL;
|
||||
Py_XDECREF(res);
|
||||
|
@ -3371,7 +3371,7 @@ expat_data_handler(XMLParserObject* self, const XML_Char* data_in,
|
|||
/* shortcut */
|
||||
res = treebuilder_handle_data((TreeBuilderObject*) self->target, data);
|
||||
else if (self->handle_data)
|
||||
res = _PyObject_FastCall(self->handle_data, &data, 1);
|
||||
res = _PyObject_CallOneArg(self->handle_data, data);
|
||||
else
|
||||
res = NULL;
|
||||
|
||||
|
@ -3398,7 +3398,7 @@ expat_end_handler(XMLParserObject* self, const XML_Char* tag_in)
|
|||
else if (self->handle_end) {
|
||||
tag = makeuniversal(self, tag_in);
|
||||
if (tag) {
|
||||
res = _PyObject_FastCall(self->handle_end, &tag, 1);
|
||||
res = _PyObject_CallOneArg(self->handle_end, tag);
|
||||
Py_DECREF(tag);
|
||||
}
|
||||
}
|
||||
|
@ -3485,7 +3485,7 @@ expat_end_ns_handler(XMLParserObject* self, const XML_Char* prefix_in)
|
|||
if (!prefix)
|
||||
return;
|
||||
|
||||
res = _PyObject_FastCall(self->handle_end_ns, &prefix, 1);
|
||||
res = _PyObject_CallOneArg(self->handle_end_ns, prefix);
|
||||
Py_DECREF(prefix);
|
||||
}
|
||||
|
||||
|
@ -3515,7 +3515,7 @@ expat_comment_handler(XMLParserObject* self, const XML_Char* comment_in)
|
|||
if (!comment)
|
||||
return;
|
||||
|
||||
res = _PyObject_FastCall(self->handle_comment, &comment, 1);
|
||||
res = _PyObject_CallOneArg(self->handle_comment, comment);
|
||||
}
|
||||
|
||||
Py_XDECREF(res);
|
||||
|
|
|
@ -557,7 +557,7 @@ _io__IOBase_readline_impl(PyObject *self, Py_ssize_t limit)
|
|||
PyObject *b;
|
||||
|
||||
if (peek != NULL) {
|
||||
PyObject *readahead = PyObject_CallFunctionObjArgs(peek, _PyLong_One, NULL);
|
||||
PyObject *readahead = _PyObject_CallOneArg(peek, _PyLong_One);
|
||||
if (readahead == NULL) {
|
||||
/* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals()
|
||||
when EINTR occurs so we needn't do it ourselves. */
|
||||
|
|
|
@ -818,14 +818,14 @@ _parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ss
|
|||
*next_idx_ptr = idx + 1;
|
||||
|
||||
if (has_pairs_hook) {
|
||||
val = PyObject_CallFunctionObjArgs(s->object_pairs_hook, rval, NULL);
|
||||
val = _PyObject_CallOneArg(s->object_pairs_hook, rval);
|
||||
Py_DECREF(rval);
|
||||
return val;
|
||||
}
|
||||
|
||||
/* if object_hook is not None: rval = object_hook(rval) */
|
||||
if (s->object_hook != Py_None) {
|
||||
val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL);
|
||||
val = _PyObject_CallOneArg(s->object_hook, rval);
|
||||
Py_DECREF(rval);
|
||||
return val;
|
||||
}
|
||||
|
@ -931,7 +931,7 @@ _parse_constant(PyScannerObject *s, const char *constant, Py_ssize_t idx, Py_ssi
|
|||
return NULL;
|
||||
|
||||
/* rval = parse_constant(constant) */
|
||||
rval = PyObject_CallFunctionObjArgs(s->parse_constant, cstr, NULL);
|
||||
rval = _PyObject_CallOneArg(s->parse_constant, cstr);
|
||||
idx += PyUnicode_GET_LENGTH(cstr);
|
||||
Py_DECREF(cstr);
|
||||
*next_idx_ptr = idx;
|
||||
|
@ -1030,7 +1030,7 @@ _match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_
|
|||
idx - start);
|
||||
if (numstr == NULL)
|
||||
return NULL;
|
||||
rval = PyObject_CallFunctionObjArgs(custom_func, numstr, NULL);
|
||||
rval = _PyObject_CallOneArg(custom_func, numstr);
|
||||
}
|
||||
else {
|
||||
Py_ssize_t i, n;
|
||||
|
@ -1440,7 +1440,7 @@ encoder_encode_string(PyEncoderObject *s, PyObject *obj)
|
|||
if (s->fast_encode) {
|
||||
return s->fast_encode(NULL, obj);
|
||||
}
|
||||
encoded = PyObject_CallFunctionObjArgs(s->encoder, obj, NULL);
|
||||
encoded = _PyObject_CallOneArg(s->encoder, obj);
|
||||
if (encoded != NULL && !PyUnicode_Check(encoded)) {
|
||||
PyErr_Format(PyExc_TypeError,
|
||||
"encoder() must return a string, not %.80s",
|
||||
|
@ -1526,7 +1526,7 @@ encoder_listencode_obj(PyEncoderObject *s, _PyAccu *acc,
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL);
|
||||
newobj = _PyObject_CallOneArg(s->defaultfn, obj);
|
||||
if (newobj == NULL) {
|
||||
Py_XDECREF(ident);
|
||||
return -1;
|
||||
|
|
|
@ -359,7 +359,7 @@ _Pickle_FastCall(PyObject *func, PyObject *obj)
|
|||
{
|
||||
PyObject *result;
|
||||
|
||||
result = PyObject_CallFunctionObjArgs(func, obj, NULL);
|
||||
result = _PyObject_CallOneArg(func, obj);
|
||||
Py_DECREF(obj);
|
||||
return result;
|
||||
}
|
||||
|
@ -420,7 +420,7 @@ call_method(PyObject *func, PyObject *self, PyObject *obj)
|
|||
return PyObject_CallFunctionObjArgs(func, self, obj, NULL);
|
||||
}
|
||||
else {
|
||||
return PyObject_CallFunctionObjArgs(func, obj, NULL);
|
||||
return _PyObject_CallOneArg(func, obj);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2296,7 +2296,7 @@ _Pickler_write_bytes(PicklerObject *self,
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
result = PyObject_CallFunctionObjArgs(self->write, payload, NULL);
|
||||
result = _PyObject_CallOneArg(self->write, payload);
|
||||
Py_XDECREF(mem);
|
||||
if (result == NULL) {
|
||||
return -1;
|
||||
|
@ -2504,8 +2504,7 @@ save_picklebuffer(PicklerObject *self, PyObject *obj)
|
|||
}
|
||||
int in_band = 1;
|
||||
if (self->buffer_callback != NULL) {
|
||||
PyObject *ret = PyObject_CallFunctionObjArgs(self->buffer_callback,
|
||||
obj, NULL);
|
||||
PyObject *ret = _PyObject_CallOneArg(self->buffer_callback, obj);
|
||||
if (ret == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -4322,8 +4321,7 @@ save(PicklerObject *self, PyObject *obj, int pers_save)
|
|||
* regular reduction mechanism.
|
||||
*/
|
||||
if (self->reducer_override != NULL) {
|
||||
reduce_value = PyObject_CallFunctionObjArgs(self->reducer_override,
|
||||
obj, NULL);
|
||||
reduce_value = _PyObject_CallOneArg(self->reducer_override, obj);
|
||||
if (reduce_value == NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
|
|
@ -112,9 +112,8 @@ void pysqlite_cache_dealloc(pysqlite_Cache* self)
|
|||
Py_TYPE(self)->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args)
|
||||
PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* key)
|
||||
{
|
||||
PyObject* key = args;
|
||||
pysqlite_Node* node;
|
||||
pysqlite_Node* ptr;
|
||||
PyObject* data;
|
||||
|
@ -184,6 +183,9 @@ PyObject* pysqlite_cache_get(pysqlite_Cache* self, PyObject* args)
|
|||
}
|
||||
}
|
||||
|
||||
/* We cannot replace this by _PyObject_CallOneArg() since
|
||||
* PyObject_CallFunction() has a special case when using a
|
||||
* single tuple as argument. */
|
||||
data = PyObject_CallFunction(self->factory, "O", key);
|
||||
|
||||
if (!data) {
|
||||
|
|
|
@ -310,7 +310,7 @@ PyObject* pysqlite_connection_cursor(pysqlite_Connection* self, PyObject* args,
|
|||
factory = (PyObject*)&pysqlite_CursorType;
|
||||
}
|
||||
|
||||
cursor = PyObject_CallFunctionObjArgs(factory, (PyObject *)self, NULL);
|
||||
cursor = _PyObject_CallOneArg(factory, (PyObject *)self);
|
||||
if (cursor == NULL)
|
||||
return NULL;
|
||||
if (!PyObject_TypeCheck(cursor, &pysqlite_CursorType)) {
|
||||
|
@ -970,7 +970,7 @@ static void _trace_callback(void* user_arg, const char* statement_string)
|
|||
py_statement = PyUnicode_DecodeUTF8(statement_string,
|
||||
strlen(statement_string), "replace");
|
||||
if (py_statement) {
|
||||
ret = PyObject_CallFunctionObjArgs((PyObject*)user_arg, py_statement, NULL);
|
||||
ret = _PyObject_CallOneArg((PyObject*)user_arg, py_statement);
|
||||
Py_DECREF(py_statement);
|
||||
}
|
||||
|
||||
|
@ -1465,16 +1465,9 @@ pysqlite_connection_iterdump(pysqlite_Connection* self, PyObject* args)
|
|||
goto finally;
|
||||
}
|
||||
|
||||
args = PyTuple_New(1);
|
||||
if (!args) {
|
||||
goto finally;
|
||||
}
|
||||
Py_INCREF(self);
|
||||
PyTuple_SetItem(args, 0, (PyObject*)self);
|
||||
retval = PyObject_CallObject(pyfn_iterdump, args);
|
||||
retval = _PyObject_CallOneArg(pyfn_iterdump, (PyObject *)self);
|
||||
|
||||
finally:
|
||||
Py_XDECREF(args);
|
||||
Py_XDECREF(module);
|
||||
return retval;
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ _pysqlite_fetch_one_row(pysqlite_Cursor* self)
|
|||
item = PyBytes_FromStringAndSize(val_str, nbytes);
|
||||
if (!item)
|
||||
goto error;
|
||||
converted = PyObject_CallFunction(converter, "O", item);
|
||||
converted = _PyObject_CallOneArg(converter, item);
|
||||
Py_DECREF(item);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -92,7 +92,7 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
|
|||
Py_DECREF(key);
|
||||
if (adapter) {
|
||||
Py_INCREF(adapter);
|
||||
adapted = PyObject_CallFunctionObjArgs(adapter, obj, NULL);
|
||||
adapted = _PyObject_CallOneArg(adapter, obj);
|
||||
Py_DECREF(adapter);
|
||||
return adapted;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
|
|||
return NULL;
|
||||
}
|
||||
if (adapter) {
|
||||
adapted = PyObject_CallFunctionObjArgs(adapter, obj, NULL);
|
||||
adapted = _PyObject_CallOneArg(adapter, obj);
|
||||
Py_DECREF(adapter);
|
||||
|
||||
if (adapted == Py_None) {
|
||||
|
@ -124,7 +124,7 @@ pysqlite_microprotocols_adapt(PyObject *obj, PyObject *proto, PyObject *alt)
|
|||
return NULL;
|
||||
}
|
||||
if (adapter) {
|
||||
adapted = PyObject_CallFunctionObjArgs(adapter, proto, NULL);
|
||||
adapted = _PyObject_CallOneArg(adapter, proto);
|
||||
Py_DECREF(adapter);
|
||||
|
||||
if (adapted == Py_None) {
|
||||
|
|
|
@ -1082,7 +1082,7 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,
|
|||
match = pattern_new_match(self, &state, 1);
|
||||
if (!match)
|
||||
goto error;
|
||||
item = PyObject_CallFunctionObjArgs(filter, match, NULL);
|
||||
item = _PyObject_CallOneArg(filter, match);
|
||||
Py_DECREF(match);
|
||||
if (!item)
|
||||
goto error;
|
||||
|
|
|
@ -2098,7 +2098,7 @@ cache_struct_converter(PyObject *fmt, PyStructObject **ptr)
|
|||
return 0;
|
||||
}
|
||||
|
||||
s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL);
|
||||
s_object = _PyObject_CallOneArg((PyObject *)(&PyStructType), fmt);
|
||||
if (s_object != NULL) {
|
||||
if (PyDict_GET_SIZE(cache) >= MAXCACHE)
|
||||
PyDict_Clear(cache);
|
||||
|
|
|
@ -104,7 +104,7 @@ static int fuzz_json_loads(const char* data, size_t size) {
|
|||
if (input_bytes == NULL) {
|
||||
return 0;
|
||||
}
|
||||
PyObject* parsed = PyObject_CallFunctionObjArgs(json_loads_method, input_bytes, NULL);
|
||||
PyObject* parsed = _PyObject_CallOneArg(json_loads_method, input_bytes);
|
||||
if (parsed == NULL) {
|
||||
/* Ignore ValueError as the fuzzer will more than likely
|
||||
generate some invalid json and values */
|
||||
|
@ -263,7 +263,7 @@ static int fuzz_sre_match(const char* data, size_t size) {
|
|||
PyObject* pattern = compiled_patterns[idx];
|
||||
PyObject* match_callable = PyObject_GetAttrString(pattern, "match");
|
||||
|
||||
PyObject* matches = PyObject_CallFunctionObjArgs(match_callable, to_match, NULL);
|
||||
PyObject* matches = _PyObject_CallOneArg(match_callable, to_match);
|
||||
|
||||
Py_XDECREF(matches);
|
||||
Py_DECREF(match_callable);
|
||||
|
|
|
@ -291,7 +291,7 @@ getcodec(PyObject *self, PyObject *encoding)
|
|||
if (codecobj == NULL)
|
||||
return NULL;
|
||||
|
||||
r = PyObject_CallFunctionObjArgs(cofunc, codecobj, NULL);
|
||||
r = _PyObject_CallOneArg(cofunc, codecobj);
|
||||
Py_DECREF(codecobj);
|
||||
|
||||
return r;
|
||||
|
|
|
@ -81,7 +81,7 @@ internal_error_callback(const char *errors)
|
|||
static PyObject *
|
||||
call_error_callback(PyObject *errors, PyObject *exc)
|
||||
{
|
||||
PyObject *args, *cb, *r;
|
||||
PyObject *cb, *r;
|
||||
const char *str;
|
||||
|
||||
assert(PyUnicode_Check(errors));
|
||||
|
@ -92,17 +92,7 @@ call_error_callback(PyObject *errors, PyObject *exc)
|
|||
if (cb == NULL)
|
||||
return NULL;
|
||||
|
||||
args = PyTuple_New(1);
|
||||
if (args == NULL) {
|
||||
Py_DECREF(cb);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
PyTuple_SET_ITEM(args, 0, exc);
|
||||
Py_INCREF(exc);
|
||||
|
||||
r = PyObject_CallObject(cb, args);
|
||||
Py_DECREF(args);
|
||||
r = _PyObject_CallOneArg(cb, exc);
|
||||
Py_DECREF(cb);
|
||||
return r;
|
||||
}
|
||||
|
|
|
@ -763,7 +763,7 @@ handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old)
|
|||
_PyObject_ASSERT(op, callback != NULL);
|
||||
|
||||
/* copy-paste of weakrefobject.c's handle_callback() */
|
||||
temp = PyObject_CallFunctionObjArgs(callback, wr, NULL);
|
||||
temp = _PyObject_CallOneArg(callback, (PyObject *)wr);
|
||||
if (temp == NULL)
|
||||
PyErr_WriteUnraisable(callback);
|
||||
else
|
||||
|
|
|
@ -134,7 +134,7 @@ groupby_step(groupbyobject *gbo)
|
|||
newkey = newvalue;
|
||||
Py_INCREF(newvalue);
|
||||
} else {
|
||||
newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, newvalue, NULL);
|
||||
newkey = _PyObject_CallOneArg(gbo->keyfunc, newvalue);
|
||||
if (newkey == NULL) {
|
||||
Py_DECREF(newvalue);
|
||||
return -1;
|
||||
|
@ -1210,7 +1210,7 @@ dropwhile_next(dropwhileobject *lz)
|
|||
if (lz->start == 1)
|
||||
return item;
|
||||
|
||||
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
|
||||
good = _PyObject_CallOneArg(lz->func, item);
|
||||
if (good == NULL) {
|
||||
Py_DECREF(item);
|
||||
return NULL;
|
||||
|
@ -1373,7 +1373,7 @@ takewhile_next(takewhileobject *lz)
|
|||
if (item == NULL)
|
||||
return NULL;
|
||||
|
||||
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
|
||||
good = _PyObject_CallOneArg(lz->func, item);
|
||||
if (good == NULL) {
|
||||
Py_DECREF(item);
|
||||
return NULL;
|
||||
|
@ -3906,7 +3906,7 @@ filterfalse_next(filterfalseobject *lz)
|
|||
ok = PyObject_IsTrue(item);
|
||||
} else {
|
||||
PyObject *good;
|
||||
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
|
||||
good = _PyObject_CallOneArg(lz->func, item);
|
||||
if (good == NULL) {
|
||||
Py_DECREF(item);
|
||||
return NULL;
|
||||
|
|
|
@ -119,7 +119,7 @@ set_error(xmlparseobject *self, enum XML_Error code)
|
|||
XML_ErrorString(code), lineno, column);
|
||||
if (buffer == NULL)
|
||||
return NULL;
|
||||
err = PyObject_CallFunctionObjArgs(ErrorObject, buffer, NULL);
|
||||
err = _PyObject_CallOneArg(ErrorObject, buffer);
|
||||
Py_DECREF(buffer);
|
||||
if ( err != NULL
|
||||
&& set_error_attr(err, "code", code)
|
||||
|
|
|
@ -172,13 +172,13 @@ PyObject_GetItem(PyObject *o, PyObject *key)
|
|||
}
|
||||
|
||||
if (PyType_Check(o)) {
|
||||
PyObject *meth, *result, *stack[1] = {key};
|
||||
PyObject *meth, *result;
|
||||
_Py_IDENTIFIER(__class_getitem__);
|
||||
if (_PyObject_LookupAttrId(o, &PyId___class_getitem__, &meth) < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (meth) {
|
||||
result = _PyObject_FastCall(meth, stack, 1);
|
||||
result = _PyObject_CallOneArg(meth, key);
|
||||
Py_DECREF(meth);
|
||||
return result;
|
||||
}
|
||||
|
@ -737,7 +737,7 @@ PyObject_Format(PyObject *obj, PyObject *format_spec)
|
|||
}
|
||||
|
||||
/* And call it. */
|
||||
result = PyObject_CallFunctionObjArgs(meth, format_spec, NULL);
|
||||
result = _PyObject_CallOneArg(meth, format_spec);
|
||||
Py_DECREF(meth);
|
||||
|
||||
if (result && !PyUnicode_Check(result)) {
|
||||
|
@ -2459,7 +2459,7 @@ PyObject_IsInstance(PyObject *inst, PyObject *cls)
|
|||
Py_DECREF(checker);
|
||||
return ok;
|
||||
}
|
||||
res = PyObject_CallFunctionObjArgs(checker, inst, NULL);
|
||||
res = _PyObject_CallOneArg(checker, inst);
|
||||
Py_LeaveRecursiveCall();
|
||||
Py_DECREF(checker);
|
||||
if (res != NULL) {
|
||||
|
@ -2533,7 +2533,7 @@ PyObject_IsSubclass(PyObject *derived, PyObject *cls)
|
|||
Py_DECREF(checker);
|
||||
return ok;
|
||||
}
|
||||
res = PyObject_CallFunctionObjArgs(checker, derived, NULL);
|
||||
res = _PyObject_CallOneArg(checker, derived);
|
||||
Py_LeaveRecursiveCall();
|
||||
Py_DECREF(checker);
|
||||
if (res != NULL) {
|
||||
|
|
|
@ -89,8 +89,7 @@ _canresize(PyByteArrayObject *self)
|
|||
PyObject *
|
||||
PyByteArray_FromObject(PyObject *input)
|
||||
{
|
||||
return PyObject_CallFunctionObjArgs((PyObject *)&PyByteArray_Type,
|
||||
input, NULL);
|
||||
return _PyObject_CallOneArg((PyObject *)&PyByteArray_Type, input);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
@ -2018,8 +2017,7 @@ bytearray_fromhex_impl(PyTypeObject *type, PyObject *string)
|
|||
{
|
||||
PyObject *result = _PyBytes_FromHex(string, type == &PyByteArray_Type);
|
||||
if (type != &PyByteArray_Type && result != NULL) {
|
||||
Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type,
|
||||
result, NULL));
|
||||
Py_SETREF(result, _PyObject_CallOneArg((PyObject *)type, result));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -2333,8 +2333,7 @@ bytes_fromhex_impl(PyTypeObject *type, PyObject *string)
|
|||
{
|
||||
PyObject *result = _PyBytes_FromHex(string, 0);
|
||||
if (type != &PyBytes_Type && result != NULL) {
|
||||
Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type,
|
||||
result, NULL));
|
||||
Py_SETREF(result, _PyObject_CallOneArg((PyObject *)type, result));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1340,8 +1340,7 @@ property_descr_get(PyObject *self, PyObject *obj, PyObject *type)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
PyObject *args[1] = {obj};
|
||||
return _PyObject_FastCall(gs->prop_get, args, 1);
|
||||
return _PyObject_CallOneArg(gs->prop_get, obj);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -1362,7 +1361,7 @@ property_descr_set(PyObject *self, PyObject *obj, PyObject *value)
|
|||
return -1;
|
||||
}
|
||||
if (value == NULL)
|
||||
res = PyObject_CallFunctionObjArgs(func, obj, NULL);
|
||||
res = _PyObject_CallOneArg(func, obj);
|
||||
else
|
||||
res = PyObject_CallFunctionObjArgs(func, obj, value, NULL);
|
||||
if (res == NULL)
|
||||
|
|
|
@ -2113,8 +2113,7 @@ dict_subscript(PyDictObject *mp, PyObject *key)
|
|||
_Py_IDENTIFIER(__missing__);
|
||||
missing = _PyObject_LookupSpecial((PyObject *)mp, &PyId___missing__);
|
||||
if (missing != NULL) {
|
||||
res = PyObject_CallFunctionObjArgs(missing,
|
||||
key, NULL);
|
||||
res = _PyObject_CallOneArg(missing, key);
|
||||
Py_DECREF(missing);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ PyFile_WriteObject(PyObject *v, PyObject *f, int flags)
|
|||
Py_DECREF(writer);
|
||||
return -1;
|
||||
}
|
||||
result = PyObject_CallFunctionObjArgs(writer, value, NULL);
|
||||
result = _PyObject_CallOneArg(writer, value);
|
||||
Py_DECREF(value);
|
||||
Py_DECREF(writer);
|
||||
if (result == NULL)
|
||||
|
|
|
@ -1501,7 +1501,7 @@ float_fromhex(PyTypeObject *type, PyObject *string)
|
|||
goto parse_error;
|
||||
result = PyFloat_FromDouble(negate ? -x : x);
|
||||
if (type != &PyFloat_Type && result != NULL) {
|
||||
Py_SETREF(result, PyObject_CallFunctionObjArgs((PyObject *)type, result, NULL));
|
||||
Py_SETREF(result, _PyObject_CallOneArg((PyObject *)type, result));
|
||||
}
|
||||
return result;
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ _PyGen_Finalize(PyObject *self)
|
|||
/* Save the current exception, if any. */
|
||||
PyErr_Fetch(&error_type, &error_value, &error_traceback);
|
||||
|
||||
res = PyObject_CallFunctionObjArgs(finalizer, self, NULL);
|
||||
res = _PyObject_CallOneArg(finalizer, self);
|
||||
|
||||
if (res == NULL) {
|
||||
PyErr_WriteUnraisable(self);
|
||||
|
@ -562,7 +562,7 @@ _PyGen_SetStopIterationValue(PyObject *value)
|
|||
return 0;
|
||||
}
|
||||
/* Construct an exception instance manually with
|
||||
* PyObject_CallFunctionObjArgs and pass it to PyErr_SetObject.
|
||||
* _PyObject_CallOneArg and pass it to PyErr_SetObject.
|
||||
*
|
||||
* We do this to handle a situation when "value" is a tuple, in which
|
||||
* case PyErr_SetObject would set the value of StopIteration to
|
||||
|
@ -570,7 +570,7 @@ _PyGen_SetStopIterationValue(PyObject *value)
|
|||
*
|
||||
* (See PyErr_SetObject/_PyErr_CreateException code for details.)
|
||||
*/
|
||||
e = PyObject_CallFunctionObjArgs(PyExc_StopIteration, value, NULL);
|
||||
e = _PyObject_CallOneArg(PyExc_StopIteration, value);
|
||||
if (e == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ async_gen_init_hooks(PyAsyncGenObject *o)
|
|||
PyObject *res;
|
||||
|
||||
Py_INCREF(firstiter);
|
||||
res = PyObject_CallFunctionObjArgs(firstiter, o, NULL);
|
||||
res = _PyObject_CallOneArg(firstiter, (PyObject *)o);
|
||||
Py_DECREF(firstiter);
|
||||
if (res == NULL) {
|
||||
return 1;
|
||||
|
|
|
@ -2258,8 +2258,7 @@ list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
|
|||
}
|
||||
|
||||
for (i = 0; i < saved_ob_size ; i++) {
|
||||
keys[i] = PyObject_CallFunctionObjArgs(keyfunc, saved_ob_item[i],
|
||||
NULL);
|
||||
keys[i] = _PyObject_CallOneArg(keyfunc, saved_ob_item[i]);
|
||||
if (keys[i] == NULL) {
|
||||
for (i=i-1 ; i>=0 ; i--)
|
||||
Py_DECREF(keys[i]);
|
||||
|
|
|
@ -5611,8 +5611,7 @@ int_from_bytes_impl(PyTypeObject *type, PyObject *bytes_obj,
|
|||
Py_DECREF(bytes);
|
||||
|
||||
if (long_obj != NULL && type != &PyLong_Type) {
|
||||
Py_SETREF(long_obj, PyObject_CallFunctionObjArgs((PyObject *)type,
|
||||
long_obj, NULL));
|
||||
Py_SETREF(long_obj, _PyObject_CallOneArg((PyObject *)type, long_obj));
|
||||
}
|
||||
|
||||
return long_obj;
|
||||
|
|
|
@ -1962,7 +1962,7 @@ struct_get_unpacker(const char *fmt, Py_ssize_t itemsize)
|
|||
if (format == NULL)
|
||||
goto error;
|
||||
|
||||
structobj = PyObject_CallFunctionObjArgs(Struct, format, NULL);
|
||||
structobj = _PyObject_CallOneArg(Struct, format);
|
||||
if (structobj == NULL)
|
||||
goto error;
|
||||
|
||||
|
@ -2001,7 +2001,7 @@ struct_unpack_single(const char *ptr, struct unpacker *x)
|
|||
PyObject *v;
|
||||
|
||||
memcpy(x->item, ptr, x->itemsize);
|
||||
v = PyObject_CallFunctionObjArgs(x->unpack_from, x->mview, NULL);
|
||||
v = _PyObject_CallOneArg(x->unpack_from, x->mview);
|
||||
if (v == NULL)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -736,8 +736,7 @@ module_getattro(PyModuleObject *m, PyObject *name)
|
|||
_Py_IDENTIFIER(__getattr__);
|
||||
getattr = _PyDict_GetItemId(m->md_dict, &PyId___getattr__);
|
||||
if (getattr) {
|
||||
PyObject* stack[1] = {name};
|
||||
return _PyObject_FastCall(getattr, stack, 1);
|
||||
return _PyObject_CallOneArg(getattr, name);
|
||||
}
|
||||
_Py_IDENTIFIER(__name__);
|
||||
mod_name = _PyDict_GetItemId(m->md_dict, &PyId___name__);
|
||||
|
|
|
@ -1459,8 +1459,7 @@ static PyObject*
|
|||
call_unbound_noarg(int unbound, PyObject *func, PyObject *self)
|
||||
{
|
||||
if (unbound) {
|
||||
PyObject *args[1] = {self};
|
||||
return _PyObject_FastCall(func, args, 1);
|
||||
return _PyObject_CallOneArg(func, self);
|
||||
}
|
||||
else {
|
||||
return _PyObject_CallNoArg(func);
|
||||
|
@ -6561,7 +6560,7 @@ call_attribute(PyObject *self, PyObject *attr, PyObject *name)
|
|||
else
|
||||
attr = descr;
|
||||
}
|
||||
res = PyObject_CallFunctionObjArgs(attr, name, NULL);
|
||||
res = _PyObject_CallOneArg(attr, name);
|
||||
Py_XDECREF(descr);
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -4248,7 +4248,7 @@ unicode_decode_call_errorhandler_wchar(
|
|||
if (*exceptionObject == NULL)
|
||||
goto onError;
|
||||
|
||||
restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL);
|
||||
restuple = _PyObject_CallOneArg(*errorHandler, *exceptionObject);
|
||||
if (restuple == NULL)
|
||||
goto onError;
|
||||
if (!PyTuple_Check(restuple)) {
|
||||
|
@ -4352,7 +4352,7 @@ unicode_decode_call_errorhandler_writer(
|
|||
if (*exceptionObject == NULL)
|
||||
goto onError;
|
||||
|
||||
restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL);
|
||||
restuple = _PyObject_CallOneArg(*errorHandler, *exceptionObject);
|
||||
if (restuple == NULL)
|
||||
goto onError;
|
||||
if (!PyTuple_Check(restuple)) {
|
||||
|
@ -6799,8 +6799,7 @@ unicode_encode_call_errorhandler(const char *errors,
|
|||
if (*exceptionObject == NULL)
|
||||
return NULL;
|
||||
|
||||
restuple = PyObject_CallFunctionObjArgs(
|
||||
*errorHandler, *exceptionObject, NULL);
|
||||
restuple = _PyObject_CallOneArg(*errorHandler, *exceptionObject);
|
||||
if (restuple == NULL)
|
||||
return NULL;
|
||||
if (!PyTuple_Check(restuple)) {
|
||||
|
@ -8778,8 +8777,7 @@ unicode_translate_call_errorhandler(const char *errors,
|
|||
if (*exceptionObject == NULL)
|
||||
return NULL;
|
||||
|
||||
restuple = PyObject_CallFunctionObjArgs(
|
||||
*errorHandler, *exceptionObject, NULL);
|
||||
restuple = _PyObject_CallOneArg(*errorHandler, *exceptionObject);
|
||||
if (restuple == NULL)
|
||||
return NULL;
|
||||
if (!PyTuple_Check(restuple)) {
|
||||
|
|
|
@ -874,7 +874,7 @@ PyWeakref_GetObject(PyObject *ref)
|
|||
static void
|
||||
handle_callback(PyWeakReference *ref, PyObject *callback)
|
||||
{
|
||||
PyObject *cbresult = PyObject_CallFunctionObjArgs(callback, ref, NULL);
|
||||
PyObject *cbresult = _PyObject_CallOneArg(callback, (PyObject *)ref);
|
||||
|
||||
if (cbresult == NULL)
|
||||
PyErr_WriteUnraisable(callback);
|
||||
|
|
|
@ -590,7 +590,7 @@ call_show_warning(PyObject *category, PyObject *text, PyObject *message,
|
|||
if (msg == NULL)
|
||||
goto error;
|
||||
|
||||
res = PyObject_CallFunctionObjArgs(show_fn, msg, NULL);
|
||||
res = _PyObject_CallOneArg(show_fn, msg);
|
||||
Py_DECREF(show_fn);
|
||||
Py_DECREF(msg);
|
||||
|
||||
|
@ -651,7 +651,7 @@ warn_explicit(PyObject *category, PyObject *message,
|
|||
}
|
||||
else {
|
||||
text = message;
|
||||
message = PyObject_CallFunctionObjArgs(category, message, NULL);
|
||||
message = _PyObject_CallOneArg(category, message);
|
||||
if (message == NULL)
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -996,7 +996,7 @@ get_source_line(PyObject *module_globals, int lineno)
|
|||
return NULL;
|
||||
}
|
||||
/* Call get_source() to get the source code. */
|
||||
source = PyObject_CallFunctionObjArgs(get_source, module_name, NULL);
|
||||
source = _PyObject_CallOneArg(get_source, module_name);
|
||||
Py_DECREF(get_source);
|
||||
Py_DECREF(module_name);
|
||||
if (!source) {
|
||||
|
@ -1283,7 +1283,7 @@ _PyErr_WarnUnawaitedCoroutine(PyObject *coro)
|
|||
int warned = 0;
|
||||
PyObject *fn = get_warnings_attr(&PyId__warn_unawaited_coroutine, 1);
|
||||
if (fn) {
|
||||
PyObject *res = PyObject_CallFunctionObjArgs(fn, coro, NULL);
|
||||
PyObject *res = _PyObject_CallOneArg(fn, coro);
|
||||
Py_DECREF(fn);
|
||||
if (res || PyErr_ExceptionMatches(PyExc_RuntimeWarning)) {
|
||||
warned = 1;
|
||||
|
|
|
@ -29,7 +29,6 @@ update_bases(PyObject *bases, PyObject *const *args, Py_ssize_t nargs)
|
|||
{
|
||||
Py_ssize_t i, j;
|
||||
PyObject *base, *meth, *new_base, *result, *new_bases = NULL;
|
||||
PyObject *stack[1] = {bases};
|
||||
assert(PyTuple_Check(bases));
|
||||
|
||||
for (i = 0; i < nargs; i++) {
|
||||
|
@ -55,7 +54,7 @@ update_bases(PyObject *bases, PyObject *const *args, Py_ssize_t nargs)
|
|||
}
|
||||
continue;
|
||||
}
|
||||
new_base = _PyObject_FastCall(meth, stack, 1);
|
||||
new_base = _PyObject_CallOneArg(meth, bases);
|
||||
Py_DECREF(meth);
|
||||
if (!new_base) {
|
||||
goto error;
|
||||
|
@ -574,7 +573,7 @@ filter_next(filterobject *lz)
|
|||
ok = PyObject_IsTrue(item);
|
||||
} else {
|
||||
PyObject *good;
|
||||
good = PyObject_CallFunctionObjArgs(lz->func, item, NULL);
|
||||
good = _PyObject_CallOneArg(lz->func, item);
|
||||
if (good == NULL) {
|
||||
Py_DECREF(item);
|
||||
return NULL;
|
||||
|
@ -1625,7 +1624,7 @@ min_max(PyObject *args, PyObject *kwds, int op)
|
|||
while (( item = PyIter_Next(it) )) {
|
||||
/* get the value from the key function */
|
||||
if (keyfunc != NULL) {
|
||||
val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL);
|
||||
val = _PyObject_CallOneArg(keyfunc, item);
|
||||
if (val == NULL)
|
||||
goto Fail_it_item;
|
||||
}
|
||||
|
@ -2178,7 +2177,7 @@ builtin_round_impl(PyObject *module, PyObject *number, PyObject *ndigits)
|
|||
if (ndigits == NULL || ndigits == Py_None)
|
||||
result = _PyObject_CallNoArg(round);
|
||||
else
|
||||
result = PyObject_CallFunctionObjArgs(round, ndigits, NULL);
|
||||
result = _PyObject_CallOneArg(round, ndigits);
|
||||
Py_DECREF(round);
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1874,7 +1874,7 @@ main_loop:
|
|||
Py_DECREF(value);
|
||||
goto error;
|
||||
}
|
||||
res = PyObject_CallFunctionObjArgs(hook, value, NULL);
|
||||
res = _PyObject_CallOneArg(hook, value);
|
||||
Py_DECREF(value);
|
||||
if (res == NULL)
|
||||
goto error;
|
||||
|
|
|
@ -99,7 +99,7 @@ PyObject *normalizestring(const char *string)
|
|||
|
||||
PyObject *_PyCodec_Lookup(const char *encoding)
|
||||
{
|
||||
PyObject *result, *args = NULL, *v;
|
||||
PyObject *result, *v;
|
||||
Py_ssize_t i, len;
|
||||
|
||||
if (encoding == NULL) {
|
||||
|
@ -132,13 +132,6 @@ PyObject *_PyCodec_Lookup(const char *encoding)
|
|||
}
|
||||
|
||||
/* Next, scan the search functions in order of registration */
|
||||
args = PyTuple_New(1);
|
||||
if (args == NULL) {
|
||||
Py_DECREF(v);
|
||||
return NULL;
|
||||
}
|
||||
PyTuple_SET_ITEM(args,0,v);
|
||||
|
||||
len = PyList_Size(interp->codec_search_path);
|
||||
if (len < 0)
|
||||
goto onError;
|
||||
|
@ -155,7 +148,7 @@ PyObject *_PyCodec_Lookup(const char *encoding)
|
|||
func = PyList_GetItem(interp->codec_search_path, i);
|
||||
if (func == NULL)
|
||||
goto onError;
|
||||
result = PyEval_CallObject(func, args);
|
||||
result = _PyObject_CallOneArg(func, v);
|
||||
if (result == NULL)
|
||||
goto onError;
|
||||
if (result == Py_None) {
|
||||
|
@ -182,11 +175,9 @@ PyObject *_PyCodec_Lookup(const char *encoding)
|
|||
Py_DECREF(result);
|
||||
goto onError;
|
||||
}
|
||||
Py_DECREF(args);
|
||||
return result;
|
||||
|
||||
onError:
|
||||
Py_XDECREF(args);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -325,7 +316,7 @@ PyObject *codec_getstreamcodec(const char *encoding,
|
|||
if (errors != NULL)
|
||||
streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors);
|
||||
else
|
||||
streamcodec = PyObject_CallFunctionObjArgs(codeccls, stream, NULL);
|
||||
streamcodec = _PyObject_CallOneArg(codeccls, stream);
|
||||
Py_DECREF(codecs);
|
||||
return streamcodec;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ _PyErr_CreateException(PyObject *exception, PyObject *value)
|
|||
return PyObject_Call(exception, value, NULL);
|
||||
}
|
||||
else {
|
||||
return PyObject_CallFunctionObjArgs(exception, value, NULL);
|
||||
return _PyObject_CallOneArg(exception, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1381,8 +1381,7 @@ _PyErr_WriteUnraisableMsg(const char *err_msg_str, PyObject *obj)
|
|||
hook_args = make_unraisable_hook_args(tstate, exc_type, exc_value,
|
||||
exc_tb, err_msg, obj);
|
||||
if (hook_args != NULL) {
|
||||
PyObject *args[1] = {hook_args};
|
||||
PyObject *res = _PyObject_FastCall(hook, args, 1);
|
||||
PyObject *res = _PyObject_CallOneArg(hook, hook_args);
|
||||
Py_DECREF(hook_args);
|
||||
if (res != NULL) {
|
||||
Py_DECREF(res);
|
||||
|
|
|
@ -1180,7 +1180,7 @@ get_path_importer(PyThreadState *tstate, PyObject *path_importer_cache,
|
|||
PyObject *hook = PyList_GetItem(path_hooks, j);
|
||||
if (hook == NULL)
|
||||
return NULL;
|
||||
importer = PyObject_CallFunctionObjArgs(hook, p, NULL);
|
||||
importer = _PyObject_CallOneArg(hook, p);
|
||||
if (importer != NULL)
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue