summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-12-06 17:45:50 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-12-06 17:45:50 (GMT)
commita5ed5f000aad67d216201d959de4c70b7575309d (patch)
treef30829b98aaada578afe0a9b1dced36e4c0f237f
parent2a358f862bb24ddfb26c45d7e4af87c073d4bc1f (diff)
downloadcpython-a5ed5f000aad67d216201d959de4c70b7575309d.zip
cpython-a5ed5f000aad67d216201d959de4c70b7575309d.tar.gz
cpython-a5ed5f000aad67d216201d959de4c70b7575309d.tar.bz2
Use _PyObject_CallNoArg()
Replace: PyObject_CallObject(callable, NULL) with: _PyObject_CallNoArg(callable)
-rw-r--r--Modules/_asynciomodule.c12
-rw-r--r--Modules/_ctypes/_ctypes.c8
-rw-r--r--Modules/_ctypes/stgdict.c2
-rw-r--r--Modules/_decimal/_decimal.c16
-rw-r--r--Modules/_functoolsmodule.c2
-rw-r--r--Modules/_testcapimodule.c2
-rw-r--r--Modules/main.c2
-rw-r--r--Objects/dictobject.c2
-rw-r--r--Objects/typeobject.c10
-rw-r--r--Parser/tokenizer.c6
-rw-r--r--Python/ceval.c4
11 files changed, 33 insertions, 33 deletions
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index ea02a5e..67794c3 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -141,7 +141,7 @@ future_init(FutureObj *fut, PyObject *loop)
_Py_IDENTIFIER(get_debug);
if (loop == NULL || loop == Py_None) {
- loop = PyObject_CallObject(asyncio_get_event_loop, NULL);
+ loop = _PyObject_CallNoArg(asyncio_get_event_loop);
if (loop == NULL) {
return -1;
}
@@ -158,7 +158,7 @@ future_init(FutureObj *fut, PyObject *loop)
}
if (PyObject_IsTrue(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) {
return -1;
}
@@ -204,7 +204,7 @@ future_set_exception(FutureObj *fut, PyObject *exc)
}
if (PyExceptionClass_Check(exc)) {
- exc_val = PyObject_CallObject(exc, NULL);
+ exc_val = _PyObject_CallNoArg(exc);
if (exc_val == NULL) {
return NULL;
}
@@ -1429,7 +1429,7 @@ _asyncio_Task_current_task_impl(PyTypeObject *type, PyObject *loop)
PyObject *res;
if (loop == NULL) {
- loop = PyObject_CallObject(asyncio_get_event_loop, NULL);
+ loop = _PyObject_CallNoArg(asyncio_get_event_loop);
if (loop == NULL) {
return NULL;
}
@@ -1514,7 +1514,7 @@ _asyncio_Task_all_tasks_impl(PyTypeObject *type, PyObject *loop)
PyObject *res;
if (loop == NULL) {
- loop = PyObject_CallObject(asyncio_get_event_loop, NULL);
+ loop = _PyObject_CallNoArg(asyncio_get_event_loop);
if (loop == NULL) {
return NULL;
}
@@ -2387,7 +2387,7 @@ module_init(void)
WITH_MOD("weakref")
GET_MOD_ATTR(cls, "WeakSet")
- all_tasks = PyObject_CallObject(cls, NULL);
+ all_tasks = _PyObject_CallNoArg(cls);
Py_CLEAR(cls);
if (all_tasks == NULL) {
goto fail;
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index 0a9201e..5048d9c 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -211,7 +211,7 @@ PyDict_SetItemProxy(PyObject *dict, PyObject *key, PyObject *item)
PyObject *proxy;
int result;
- obj = PyObject_CallObject((PyObject *)&DictRemover_Type, NULL);
+ obj = _PyObject_CallNoArg((PyObject *)&DictRemover_Type);
if (obj == NULL)
return -1;
@@ -373,7 +373,7 @@ StructUnionType_new(PyTypeObject *type, PyObject *args, PyObject *kwds, int isSt
if (PyDict_GetItemString(result->tp_dict, "_abstract_"))
return (PyObject *)result;
- dict = (StgDictObject *)PyObject_CallObject((PyObject *)&PyCStgDict_Type, NULL);
+ dict = (StgDictObject *)_PyObject_CallNoArg((PyObject *)&PyCStgDict_Type);
if (!dict) {
Py_DECREF(result);
return NULL;
@@ -3654,10 +3654,10 @@ _build_callargs(PyCFuncPtrObject *self, PyObject *argtypes,
goto error;
}
if (PyCArrayTypeObject_Check(ob))
- ob = PyObject_CallObject(ob, NULL);
+ ob = _PyObject_CallNoArg(ob);
else
/* 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?
We must not pass a byref() to the array then but
diff --git a/Modules/_ctypes/stgdict.c b/Modules/_ctypes/stgdict.c
index 53cfa79..1ccaf2f 100644
--- a/Modules/_ctypes/stgdict.c
+++ b/Modules/_ctypes/stgdict.c
@@ -228,7 +228,7 @@ MakeFields(PyObject *type, CFieldObject *descr,
}
continue;
}
- new_descr = (CFieldObject *)PyObject_CallObject((PyObject *)&PyCField_Type, NULL);
+ new_descr = (CFieldObject *)_PyObject_CallNoArg((PyObject *)&PyCField_Type);
if (new_descr == NULL) {
Py_DECREF(fdescr);
Py_DECREF(fieldlist);
diff --git a/Modules/_decimal/_decimal.c b/Modules/_decimal/_decimal.c
index 9956786..9797089 100644
--- a/Modules/_decimal/_decimal.c
+++ b/Modules/_decimal/_decimal.c
@@ -1194,13 +1194,13 @@ context_new(PyTypeObject *type, PyObject *args UNUSED, PyObject *kwds UNUSED)
return NULL;
}
- self->traps = PyObject_CallObject((PyObject *)PyDecSignalDict_Type, NULL);
+ self->traps = _PyObject_CallNoArg((PyObject *)PyDecSignalDict_Type);
if (self->traps == NULL) {
self->flags = NULL;
Py_DECREF(self);
return NULL;
}
- self->flags = PyObject_CallObject((PyObject *)PyDecSignalDict_Type, NULL);
+ self->flags = _PyObject_CallNoArg((PyObject *)PyDecSignalDict_Type);
if (self->flags == NULL) {
Py_DECREF(self);
return NULL;
@@ -1395,7 +1395,7 @@ ieee_context(PyObject *dummy UNUSED, PyObject *v)
goto error;
}
- context = PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL);
+ context = _PyObject_CallNoArg((PyObject *)&PyDecContext_Type);
if (context == NULL) {
return NULL;
}
@@ -1417,7 +1417,7 @@ context_copy(PyObject *self, PyObject *args UNUSED)
{
PyObject *copy;
- copy = PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL);
+ copy = _PyObject_CallNoArg((PyObject *)&PyDecContext_Type);
if (copy == NULL) {
return NULL;
}
@@ -5835,7 +5835,7 @@ PyInit__decimal(void)
/* Init default context template first */
ASSIGN_PTR(default_context_template,
- PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL));
+ _PyObject_CallNoArg((PyObject *)&PyDecContext_Type));
Py_INCREF(default_context_template);
CHECK_INT(PyModule_AddObject(m, "DefaultContext",
default_context_template));
@@ -5843,7 +5843,7 @@ PyInit__decimal(void)
#ifdef WITHOUT_THREADS
/* Init module context */
ASSIGN_PTR(module_context,
- PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL));
+ _PyObject_CallNoArg((PyObject *)&PyDecContext_Type));
Py_INCREF(Py_False);
CHECK_INT(PyModule_AddObject(m, "HAVE_THREADS", Py_False));
#else
@@ -5854,7 +5854,7 @@ PyInit__decimal(void)
/* Init 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);
Py_INCREF(basic_context_template);
CHECK_INT(PyModule_AddObject(m, "BasicContext",
@@ -5862,7 +5862,7 @@ PyInit__decimal(void)
/* Init 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);
Py_INCREF(extended_context_template);
CHECK_INT(PyModule_AddObject(m, "ExtendedContext",
diff --git a/Modules/_functoolsmodule.c b/Modules/_functoolsmodule.c
index 2269d05..19ca65b 100644
--- a/Modules/_functoolsmodule.c
+++ b/Modules/_functoolsmodule.c
@@ -1246,7 +1246,7 @@ PyInit__functools(void)
if (m == NULL)
return NULL;
- kwd_mark = PyObject_CallObject((PyObject *)&PyBaseObject_Type, NULL);
+ kwd_mark = _PyObject_CallNoArg((PyObject *)&PyBaseObject_Type);
if (!kwd_mark) {
Py_DECREF(m);
return NULL;
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 8ad54dd..06e6ebe 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -2277,7 +2277,7 @@ static int _pending_callback(void *arg)
{
/* we assume the argument is callable object to which we own a reference */
PyObject *callable = (PyObject *)arg;
- PyObject *r = PyObject_CallObject(callable, NULL);
+ PyObject *r = _PyObject_CallNoArg(callable);
Py_DECREF(callable);
Py_XDECREF(r);
return r != NULL ? 0 : -1;
diff --git a/Modules/main.c b/Modules/main.c
index d75f64a..8691d15 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -157,7 +157,7 @@ static void RunInteractiveHook(void)
if (hook == NULL)
PyErr_Clear();
else {
- result = PyObject_CallObject(hook, NULL);
+ result = _PyObject_CallNoArg(hook);
Py_DECREF(hook);
if (result == NULL)
goto error;
diff --git a/Objects/dictobject.c b/Objects/dictobject.c
index 2a01f70..6ec4e0a 100644
--- a/Objects/dictobject.c
+++ b/Objects/dictobject.c
@@ -1843,7 +1843,7 @@ _PyDict_FromKeys(PyObject *cls, PyObject *iterable, PyObject *value)
PyObject *d;
int status;
- d = PyObject_CallObject(cls, NULL);
+ d = _PyObject_CallNoArg(cls);
if (d == NULL)
return NULL;
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 0fcdd7d..1758de2 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -1856,7 +1856,7 @@ mro_invoke(PyTypeObject *type)
PyObject *mro_meth = lookup_method((PyObject *)type, &PyId_mro);
if (mro_meth == NULL)
return NULL;
- mro_result = PyObject_CallObject(mro_meth, NULL);
+ mro_result = _PyObject_CallNoArg(mro_meth);
Py_DECREF(mro_meth);
}
else {
@@ -4032,7 +4032,7 @@ _PyObject_GetState(PyObject *obj, int required)
Py_DECREF(slotnames);
}
else { /* getstate != NULL */
- state = PyObject_CallObject(getstate, NULL);
+ state = _PyObject_CallNoArg(getstate);
Py_DECREF(getstate);
if (state == NULL)
return NULL;
@@ -4057,7 +4057,7 @@ _PyObject_GetNewArguments(PyObject *obj, PyObject **args, PyObject **kwargs)
__getnewargs_ex__ on the object. */
getnewargs_ex = _PyObject_LookupSpecial(obj, &PyId___getnewargs_ex__);
if (getnewargs_ex != NULL) {
- PyObject *newargs = PyObject_CallObject(getnewargs_ex, NULL);
+ PyObject *newargs = _PyObject_CallNoArg(getnewargs_ex);
Py_DECREF(getnewargs_ex);
if (newargs == NULL) {
return -1;
@@ -4110,7 +4110,7 @@ _PyObject_GetNewArguments(PyObject *obj, PyObject **args, PyObject **kwargs)
__getnewargs__ instead. */
getnewargs = _PyObject_LookupSpecial(obj, &PyId___getnewargs__);
if (getnewargs != NULL) {
- *args = PyObject_CallObject(getnewargs, NULL);
+ *args = _PyObject_CallNoArg(getnewargs);
Py_DECREF(getnewargs);
if (*args == NULL) {
return -1;
@@ -4362,7 +4362,7 @@ object_reduce_ex(PyObject *self, PyObject *args)
override = (clsreduce != objreduce);
Py_DECREF(clsreduce);
if (override) {
- res = PyObject_CallObject(reduce, NULL);
+ res = _PyObject_CallNoArg(reduce);
Py_DECREF(reduce);
return res;
}
diff --git a/Parser/tokenizer.c b/Parser/tokenizer.c
index 0fa3aeb..10639ed 100644
--- a/Parser/tokenizer.c
+++ b/Parser/tokenizer.c
@@ -440,7 +440,7 @@ fp_readl(char *s, int size, struct tok_state *tok)
}
else
{
- bufobj = PyObject_CallObject(tok->decoding_readline, NULL);
+ bufobj = _PyObject_CallNoArg(tok->decoding_readline);
if (bufobj == NULL)
goto error;
}
@@ -533,7 +533,7 @@ fp_setreadl(struct tok_state *tok, const char* enc)
Py_XSETREF(tok->decoding_readline, readline);
if (pos > 0) {
- PyObject *bufobj = PyObject_CallObject(readline, NULL);
+ PyObject *bufobj = _PyObject_CallNoArg(readline);
if (bufobj == NULL)
return 0;
Py_DECREF(bufobj);
@@ -650,7 +650,7 @@ decoding_feof(struct tok_state *tok)
} else {
PyObject* buf = tok->decoding_buffer;
if (buf == NULL) {
- buf = PyObject_CallObject(tok->decoding_readline, NULL);
+ buf = _PyObject_CallNoArg(tok->decoding_readline);
if (buf == NULL) {
error_ret(tok);
return 1;
diff --git a/Python/ceval.c b/Python/ceval.c
index 8b17c09..8420aec 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -4198,7 +4198,7 @@ do_raise(PyObject *exc, PyObject *cause)
if (PyExceptionClass_Check(exc)) {
type = exc;
- value = PyObject_CallObject(exc, NULL);
+ value = _PyObject_CallNoArg(exc);
if (value == NULL)
goto raise_error;
if (!PyExceptionInstance_Check(value)) {
@@ -4229,7 +4229,7 @@ do_raise(PyObject *exc, PyObject *cause)
if (cause) {
PyObject *fixed_cause;
if (PyExceptionClass_Check(cause)) {
- fixed_cause = PyObject_CallObject(cause, NULL);
+ fixed_cause = _PyObject_CallNoArg(cause);
if (fixed_cause == NULL)
goto raise_error;
Py_DECREF(cause);