Skip to content

Commit 9bbf8e0

Browse files
author
georg.brandl
committed
Simplify calling.
git-svn-id: http://svn.python.org/projects/python/trunk@46415 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent 55083b7 commit 9bbf8e0

1 file changed

Lines changed: 2 additions & 8 deletions

File tree

Objects/classobject.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,21 +1072,15 @@ static PyMappingMethods instance_as_mapping = {
10721072
static PyObject *
10731073
instance_item(PyInstanceObject *inst, Py_ssize_t i)
10741074
{
1075-
PyObject *func, *arg, *res;
1075+
PyObject *func, *res;
10761076

10771077
if (getitemstr == NULL)
10781078
getitemstr = PyString_InternFromString("__getitem__");
10791079
func = instance_getattr(inst, getitemstr);
10801080
if (func == NULL)
10811081
return NULL;
1082-
arg = Py_BuildValue("(n)", i);
1083-
if (arg == NULL) {
1084-
Py_DECREF(func);
1085-
return NULL;
1086-
}
1087-
res = PyEval_CallObject(func, arg);
1082+
res = PyObject_CallFunction(func, "n", i);
10881083
Py_DECREF(func);
1089-
Py_DECREF(arg);
10901084
return res;
10911085
}
10921086

0 commit comments

Comments
 (0)