Use _PyObject_CallNoArg()
Replace: PyObject_CallObject(callable, NULL) with: _PyObject_CallNoArg(callable)
This commit is contained in:
parent
2a358f862b
commit
a5ed5f000a
|
@ -141,7 +141,7 @@ future_init(FutureObj *fut, PyObject *loop)
|
||||||
_Py_IDENTIFIER(get_debug);
|
_Py_IDENTIFIER(get_debug);
|
||||||
|
|
||||||
if (loop == NULL || loop == Py_None) {
|
if (loop == NULL || loop == Py_None) {
|
||||||
loop = PyObject_CallObject(asyncio_get_event_loop, NULL);
|
loop = _PyObject_CallNoArg(asyncio_get_event_loop);
|
||||||
if (loop == NULL) {
|
if (loop == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ future_init(FutureObj *fut, PyObject *loop)
|
||||||
}
|
}
|
||||||
if (PyObject_IsTrue(res)) {
|
if (PyObject_IsTrue(res)) {
|
||||||
Py_CLEAR(res);
|
Py_CLEAR(res);
|
||||||
fut->fut_source_tb = PyObject_CallObject(traceback_extract_stack, NULL);
|
fut->fut_source_tb = _PyObject_CallNoArg(traceback_extract_stack);
|
||||||
if (fut->fut_source_tb == NULL) {
|
if (fut->fut_source_tb == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -204,7 +204,7 @@ future_set_exception(FutureObj *fut, PyObject *exc)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PyExceptionClass_Check(exc)) {
|
if (PyExceptionClass_Check(exc)) {
|
||||||
exc_val = PyObject_CallObject(exc, NULL);
|
exc_val = _PyObject_CallNoArg(exc);
|
||||||
if (exc_val == NULL) {
|
if (exc_val == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1429,7 +1429,7 @@ _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop)
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
|
||||||
if (loop == NULL) {
|
if (loop == NULL) {
|
||||||
loop = PyObject_CallObject(asyncio_get_event_loop, NULL);
|
loop = _PyObject_CallNoArg(asyncio_get_event_loop);
|
||||||
if (loop == NULL) {
|
if (loop == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1514,7 +1514,7 @@ _asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop)
|
||||||
PyObject *res;
|
PyObject *res;
|
||||||
|
|
||||||
if (loop == NULL) {
|
if (loop == NULL) {
|
||||||
loop = PyObject_CallObject(asyncio_get_event_loop, NULL);
|
loop = _PyObject_CallNoArg(asyncio_get_event_loop);
|
||||||
if (loop == NULL) {
|
if (loop == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2387,7 +2387,7 @@ module_init(void)
|
||||||
|
|
||||||
WITH_MOD("weakref")
|
WITH_MOD("weakref")
|
||||||
GET_MOD_ATTR(cls, "WeakSet")
|
GET_MOD_ATTR(cls, "WeakSet")
|
||||||
all_tasks = PyObject_CallObject(cls, NULL);
|
all_tasks = _PyObject_CallNoArg(cls);
|
||||||
Py_CLEAR(cls);
|
Py_CLEAR(cls);
|
||||||
if (all_tasks == NULL) {
|
if (all_tasks == NULL) {
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
|
@ -211,7 +211,7 @@ PyDict_SetItemProxy(PyObject *dict, PyObject *key, PyObject *item)
|
||||||
PyObject *proxy;
|
PyObject *proxy;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
obj = PyObject_CallObject((PyObject *)&DictRemover_Type, NULL);
|
obj = _PyObject_CallNoArg((PyObject *)&DictRemover_Type);
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ StructUnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds, int isSt
|
||||||
if (PyDict_GetItemString(result->tp_dict, "_abstract_"))
|
if (PyDict_GetItemString(result->tp_dict, "_abstract_"))
|
||||||
return (PyObject *)result;
|
return (PyObject *)result;
|
||||||
|
|
||||||
dict = (StgDictObject *)PyObject_CallObject((PyObject *)&PyCStgDict_Type, NULL);
|
dict = (StgDictObject *)_PyObject_CallNoArg((PyObject *)&PyCStgDict_Type);
|
||||||
if (!dict) {
|
if (!dict) {
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -3654,10 +3654,10 @@ _build_callargs(PyCFuncPtrObject *self, PyObject *argtypes,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
if (PyCArrayTypeObject_Check(ob))
|
if (PyCArrayTypeObject_Check(ob))
|
||||||
ob = PyObject_CallObject(ob, NULL);
|
ob = _PyObject_CallNoArg(ob);
|
||||||
else
|
else
|
||||||
/* Create an instance of the pointed-to type */
|
/* Create an instance of the pointed-to type */
|
||||||
ob = PyObject_CallObject(dict->proto, NULL);
|
ob = _PyObject_CallNoArg(dict->proto);
|
||||||
/*
|
/*
|
||||||
XXX Is the following correct any longer?
|
XXX Is the following correct any longer?
|
||||||
We must not pass a byref() to the array then but
|
We must not pass a byref() to the array then but
|
||||||
|
|
|
@ -228,7 +228,7 @@ MakeFields(PyObject *type, CFieldObject *descr,
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
new_descr = (CFieldObject *)PyObject_CallObject((PyObject *)&PyCField_Type, NULL);
|
new_descr = (CFieldObject *)_PyObject_CallNoArg((PyObject *)&PyCField_Type);
|
||||||
if (new_descr == NULL) {
|
if (new_descr == NULL) {
|
||||||
Py_DECREF(fdescr);
|
Py_DECREF(fdescr);
|
||||||
Py_DECREF(fieldlist);
|
Py_DECREF(fieldlist);
|
||||||
|
|
|
@ -1194,13 +1194,13 @@ context_new(PyTypeObject *type, PyObject *args UNUSED, PyObject *kwds UNUSED)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
self->traps = PyObject_CallObject((PyObject *)PyDecSignalDict_Type, NULL);
|
self->traps = _PyObject_CallNoArg((PyObject *)PyDecSignalDict_Type);
|
||||||
if (self->traps == NULL) {
|
if (self->traps == NULL) {
|
||||||
self->flags = NULL;
|
self->flags = NULL;
|
||||||
Py_DECREF(self);
|
Py_DECREF(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
self->flags = PyObject_CallObject((PyObject *)PyDecSignalDict_Type, NULL);
|
self->flags = _PyObject_CallNoArg((PyObject *)PyDecSignalDict_Type);
|
||||||
if (self->flags == NULL) {
|
if (self->flags == NULL) {
|
||||||
Py_DECREF(self);
|
Py_DECREF(self);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -1395,7 +1395,7 @@ ieee_context(PyObject *dummy UNUSED, PyObject *v)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
context = PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL);
|
context = _PyObject_CallNoArg((PyObject *)&PyDecContext_Type);
|
||||||
if (context == NULL) {
|
if (context == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1417,7 +1417,7 @@ context_copy(PyObject *self, PyObject *args UNUSED)
|
||||||
{
|
{
|
||||||
PyObject *copy;
|
PyObject *copy;
|
||||||
|
|
||||||
copy = PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL);
|
copy = _PyObject_CallNoArg((PyObject *)&PyDecContext_Type);
|
||||||
if (copy == NULL) {
|
if (copy == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -5835,7 +5835,7 @@ PyInit__decimal(void)
|
||||||
|
|
||||||
/* Init default context template first */
|
/* Init default context template first */
|
||||||
ASSIGN_PTR(default_context_template,
|
ASSIGN_PTR(default_context_template,
|
||||||
PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL));
|
_PyObject_CallNoArg((PyObject *)&PyDecContext_Type));
|
||||||
Py_INCREF(default_context_template);
|
Py_INCREF(default_context_template);
|
||||||
CHECK_INT(PyModule_AddObject(m, "DefaultContext",
|
CHECK_INT(PyModule_AddObject(m, "DefaultContext",
|
||||||
default_context_template));
|
default_context_template));
|
||||||
|
@ -5843,7 +5843,7 @@ PyInit__decimal(void)
|
||||||
#ifdef WITHOUT_THREADS
|
#ifdef WITHOUT_THREADS
|
||||||
/* Init module context */
|
/* Init module context */
|
||||||
ASSIGN_PTR(module_context,
|
ASSIGN_PTR(module_context,
|
||||||
PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL));
|
_PyObject_CallNoArg((PyObject *)&PyDecContext_Type));
|
||||||
Py_INCREF(Py_False);
|
Py_INCREF(Py_False);
|
||||||
CHECK_INT(PyModule_AddObject(m, "HAVE_THREADS", Py_False));
|
CHECK_INT(PyModule_AddObject(m, "HAVE_THREADS", Py_False));
|
||||||
#else
|
#else
|
||||||
|
@ -5854,7 +5854,7 @@ PyInit__decimal(void)
|
||||||
|
|
||||||
/* Init basic context template */
|
/* Init basic context template */
|
||||||
ASSIGN_PTR(basic_context_template,
|
ASSIGN_PTR(basic_context_template,
|
||||||
PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL));
|
_PyObject_CallNoArg((PyObject *)&PyDecContext_Type));
|
||||||
init_basic_context(basic_context_template);
|
init_basic_context(basic_context_template);
|
||||||
Py_INCREF(basic_context_template);
|
Py_INCREF(basic_context_template);
|
||||||
CHECK_INT(PyModule_AddObject(m, "BasicContext",
|
CHECK_INT(PyModule_AddObject(m, "BasicContext",
|
||||||
|
@ -5862,7 +5862,7 @@ PyInit__decimal(void)
|
||||||
|
|
||||||
/* Init extended context template */
|
/* Init extended context template */
|
||||||
ASSIGN_PTR(extended_context_template,
|
ASSIGN_PTR(extended_context_template,
|
||||||
PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL));
|
_PyObject_CallNoArg((PyObject *)&PyDecContext_Type));
|
||||||
init_extended_context(extended_context_template);
|
init_extended_context(extended_context_template);
|
||||||
Py_INCREF(extended_context_template);
|
Py_INCREF(extended_context_template);
|
||||||
CHECK_INT(PyModule_AddObject(m, "ExtendedContext",
|
CHECK_INT(PyModule_AddObject(m, "ExtendedContext",
|
||||||
|
|
|
@ -1246,7 +1246,7 @@ PyInit__functools(void)
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
kwd_mark = PyObject_CallObject((PyObject *)&PyBaseObject_Type, NULL);
|
kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
|
||||||
if (!kwd_mark) {
|
if (!kwd_mark) {
|
||||||
Py_DECREF(m);
|
Py_DECREF(m);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -2277,7 +2277,7 @@ static int _pending_callback(void *arg)
|
||||||
{
|
{
|
||||||
/* we assume the argument is callable object to which we own a reference */
|
/* we assume the argument is callable object to which we own a reference */
|
||||||
PyObject *callable = (PyObject *)arg;
|
PyObject *callable = (PyObject *)arg;
|
||||||
PyObject *r = PyObject_CallObject(callable, NULL);
|
PyObject *r = _PyObject_CallNoArg(callable);
|
||||||
Py_DECREF(callable);
|
Py_DECREF(callable);
|
||||||
Py_XDECREF(r);
|
Py_XDECREF(r);
|
||||||
return r != NULL ? 0 : -1;
|
return r != NULL ? 0 : -1;
|
||||||
|
|
|
@ -157,7 +157,7 @@ static void RunInteractiveHook(void)
|
||||||
if (hook == NULL)
|
if (hook == NULL)
|
||||||
PyErr_Clear();
|
PyErr_Clear();
|
||||||
else {
|
else {
|
||||||
result = PyObject_CallObject(hook, NULL);
|
result = _PyObject_CallNoArg(hook);
|
||||||
Py_DECREF(hook);
|
Py_DECREF(hook);
|
||||||
if (result == NULL)
|
if (result == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
|
@ -1843,7 +1843,7 @@ _PyDict_FromKeys(PyObject *cls, PyObject *iterable, PyObject *value)
|
||||||
PyObject *d;
|
PyObject *d;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
d = PyObject_CallObject(cls, NULL);
|
d = _PyObject_CallNoArg(cls);
|
||||||
if (d == NULL)
|
if (d == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
|
@ -1856,7 +1856,7 @@ mro_invoke(PyTypeObject *type)
|
||||||
PyObject *mro_meth = lookup_method((PyObject *)type, &PyId_mro);
|
PyObject *mro_meth = lookup_method((PyObject *)type, &PyId_mro);
|
||||||
if (mro_meth == NULL)
|
if (mro_meth == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
mro_result = PyObject_CallObject(mro_meth, NULL);
|
mro_result = _PyObject_CallNoArg(mro_meth);
|
||||||
Py_DECREF(mro_meth);
|
Py_DECREF(mro_meth);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -4032,7 +4032,7 @@ _PyObject_GetState(PyObject *obj, int required)
|
||||||
Py_DECREF(slotnames);
|
Py_DECREF(slotnames);
|
||||||
}
|
}
|
||||||
else { /* getstate != NULL */
|
else { /* getstate != NULL */
|
||||||
state = PyObject_CallObject(getstate, NULL);
|
state = _PyObject_CallNoArg(getstate);
|
||||||
Py_DECREF(getstate);
|
Py_DECREF(getstate);
|
||||||
if (state == NULL)
|
if (state == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -4057,7 +4057,7 @@ _PyObject_GetNewArguments(PyObject *obj, PyObject **args, PyObject **kwargs)
|
||||||
__getnewargs_ex__ on the object. */
|
__getnewargs_ex__ on the object. */
|
||||||
getnewargs_ex = _PyObject_LookupSpecial(obj, &PyId___getnewargs_ex__);
|
getnewargs_ex = _PyObject_LookupSpecial(obj, &PyId___getnewargs_ex__);
|
||||||
if (getnewargs_ex != NULL) {
|
if (getnewargs_ex != NULL) {
|
||||||
PyObject *newargs = PyObject_CallObject(getnewargs_ex, NULL);
|
PyObject *newargs = _PyObject_CallNoArg(getnewargs_ex);
|
||||||
Py_DECREF(getnewargs_ex);
|
Py_DECREF(getnewargs_ex);
|
||||||
if (newargs == NULL) {
|
if (newargs == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -4110,7 +4110,7 @@ _PyObject_GetNewArguments(PyObject *obj, PyObject **args, PyObject **kwargs)
|
||||||
__getnewargs__ instead. */
|
__getnewargs__ instead. */
|
||||||
getnewargs = _PyObject_LookupSpecial(obj, &PyId___getnewargs__);
|
getnewargs = _PyObject_LookupSpecial(obj, &PyId___getnewargs__);
|
||||||
if (getnewargs != NULL) {
|
if (getnewargs != NULL) {
|
||||||
*args = PyObject_CallObject(getnewargs, NULL);
|
*args = _PyObject_CallNoArg(getnewargs);
|
||||||
Py_DECREF(getnewargs);
|
Py_DECREF(getnewargs);
|
||||||
if (*args == NULL) {
|
if (*args == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -4362,7 +4362,7 @@ object_reduce_ex(PyObject *self, PyObject *args)
|
||||||
override = (clsreduce != objreduce);
|
override = (clsreduce != objreduce);
|
||||||
Py_DECREF(clsreduce);
|
Py_DECREF(clsreduce);
|
||||||
if (override) {
|
if (override) {
|
||||||
res = PyObject_CallObject(reduce, NULL);
|
res = _PyObject_CallNoArg(reduce);
|
||||||
Py_DECREF(reduce);
|
Py_DECREF(reduce);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -440,7 +440,7 @@ fp_readl(char *s, int size, struct tok_state *tok)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bufobj = PyObject_CallObject(tok->decoding_readline, NULL);
|
bufobj = _PyObject_CallNoArg(tok->decoding_readline);
|
||||||
if (bufobj == NULL)
|
if (bufobj == NULL)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -533,7 +533,7 @@ fp_setreadl(struct tok_state *tok, const char* enc)
|
||||||
Py_XSETREF(tok->decoding_readline, readline);
|
Py_XSETREF(tok->decoding_readline, readline);
|
||||||
|
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
PyObject *bufobj = PyObject_CallObject(readline, NULL);
|
PyObject *bufobj = _PyObject_CallNoArg(readline);
|
||||||
if (bufobj == NULL)
|
if (bufobj == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
Py_DECREF(bufobj);
|
Py_DECREF(bufobj);
|
||||||
|
@ -650,7 +650,7 @@ decoding_feof(struct tok_state *tok)
|
||||||
} else {
|
} else {
|
||||||
PyObject* buf = tok->decoding_buffer;
|
PyObject* buf = tok->decoding_buffer;
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
buf = PyObject_CallObject(tok->decoding_readline, NULL);
|
buf = _PyObject_CallNoArg(tok->decoding_readline);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
error_ret(tok);
|
error_ret(tok);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -4198,7 +4198,7 @@ do_raise(PyObject *exc, PyObject *cause)
|
||||||
|
|
||||||
if (PyExceptionClass_Check(exc)) {
|
if (PyExceptionClass_Check(exc)) {
|
||||||
type = exc;
|
type = exc;
|
||||||
value = PyObject_CallObject(exc, NULL);
|
value = _PyObject_CallNoArg(exc);
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
goto raise_error;
|
goto raise_error;
|
||||||
if (!PyExceptionInstance_Check(value)) {
|
if (!PyExceptionInstance_Check(value)) {
|
||||||
|
@ -4229,7 +4229,7 @@ do_raise(PyObject *exc, PyObject *cause)
|
||||||
if (cause) {
|
if (cause) {
|
||||||
PyObject *fixed_cause;
|
PyObject *fixed_cause;
|
||||||
if (PyExceptionClass_Check(cause)) {
|
if (PyExceptionClass_Check(cause)) {
|
||||||
fixed_cause = PyObject_CallObject(cause, NULL);
|
fixed_cause = _PyObject_CallNoArg(cause);
|
||||||
if (fixed_cause == NULL)
|
if (fixed_cause == NULL)
|
||||||
goto raise_error;
|
goto raise_error;
|
||||||
Py_DECREF(cause);
|
Py_DECREF(cause);
|
||||||
|
|
Loading…
Reference in New Issue