PyTuple_SET_ITEM(arg, 0, bytes);
- if ((str = PyObject_CallObject(meth, arg)) == NULL)
+ if ((str = PyObject_Call(meth, arg, NULL)) == NULL)
goto finally;
/* XXX what to do if it returns a Unicode string? */
return NULL;
args = a;
}
- retval = PyObject_CallObject(callable, args);
+ retval = PyObject_Call(callable, args, NULL);
Py_DECREF(args);
args = a;
}
- retval = PyObject_CallObject(func, args);
+ retval = PyObject_Call(func, args, NULL);
Py_DECREF(args);
Py_DECREF(func);
calliter_iternext(calliterobject *it)
{
if (it->it_callable != NULL) {
- PyObject *result = PyObject_CallObject(it->it_callable, NULL);
+ PyObject *args = PyTuple_New(0);
+ PyObject *result;
+ if (args == NULL)
+ return NULL;
+ result = PyObject_Call(it->it_callable, args, NULL);
+ Py_DECREF(args);
if (result != NULL) {
int ok;
ok = PyObject_RichCompareBool(result,
static int
slot_nb_nonzero(PyObject *self)
{
- PyObject *func, *res;
+ PyObject *func, *res, *args;
static PyObject *nonzero_str, *len_str;
func = lookup_maybe(self, "__nonzero__", &nonzero_str);
return 1;
}
}
- res = PyObject_CallObject(func, NULL);
+ args = res = PyTuple_New(0);
+ if (args != NULL) {
+ res = PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ }
Py_DECREF(func);
if (res == NULL)
return -1;
func = lookup_method(self, "__iter__", &iter_str);
if (func != NULL) {
- res = PyObject_CallObject(func, NULL);
- Py_DECREF(func);
- return res;
+ PyObject *args;
+ args = res = PyTuple_New(0);
+ if (args != NULL) {
+ res = PyObject_Call(func, args, NULL);
+ Py_DECREF(args);
+ }
+ Py_DECREF(func);
+ return res;
}
PyErr_Clear();
func = lookup_method(self, "__getitem__", &getitem_str);
#ifndef Py_USING_UNICODE
/* In a non-Unicode built, this should never be called. */
Py_FatalError("fp_readl should not be called in this build.");
- return NULL;
+ return NULL; /* Keep compiler happy (not reachable) */
#else
PyObject* utf8;
PyObject* buf = tok->decoding_buffer;
if (buf == NULL) {
- buf = PyObject_CallObject(tok->decoding_readline, NULL);
+ PyObject *args = PyTuple_New(0);
+ if (args == NULL)
+ return error_ret(tok);
+ buf = PyObject_Call(tok->decoding_readline, args, NULL);
+ Py_DECREF(args);
if (buf == NULL)
return error_ret(tok);
} else {
} else {
PyObject* buf = tok->decoding_buffer;
if (buf == NULL) {
- buf = PyObject_CallObject(tok->decoding_readline, NULL);
+ PyObject *args = PyTuple_New(0);
+ if (args == NULL) {
+ error_ret(tok);
+ return 1;
+ }
+ buf = PyObject_Call(tok->decoding_readline,
+ args, NULL);
+ Py_DECREF(args);
if (buf == NULL) {
error_ret(tok);
return 1;