summaryrefslogtreecommitdiffstats
path: root/Objects/classobject.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2006-05-26 20:22:50 (GMT)
committerGeorg Brandl <georg@python.org>2006-05-26 20:22:50 (GMT)
commite4e023c4d3104cbf144437d25e6906e828a28993 (patch)
tree0943e80c3986b261c3f320ef44934ccb3fcbd69f /Objects/classobject.c
parenta89dbec2576903ab1e95a365df1fccba38c8cb52 (diff)
downloadcpython-e4e023c4d3104cbf144437d25e6906e828a28993.zip
cpython-e4e023c4d3104cbf144437d25e6906e828a28993.tar.gz
cpython-e4e023c4d3104cbf144437d25e6906e828a28993.tar.bz2
Simplify calling.
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r--Objects/classobject.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index a89366b..2fb16eb 100644
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -1072,21 +1072,15 @@ static PyMappingMethods instance_as_mapping = {
static PyObject *
instance_item(PyInstanceObject *inst, Py_ssize_t i)
{
- PyObject *func, *arg, *res;
+ PyObject *func, *res;
if (getitemstr == NULL)
getitemstr = PyString_InternFromString("__getitem__");
func = instance_getattr(inst, getitemstr);
if (func == NULL)
return NULL;
- arg = Py_BuildValue("(n)", i);
- if (arg == NULL) {
- Py_DECREF(func);
- return NULL;
- }
- res = PyEval_CallObject(func, arg);
+ res = PyObject_CallFunction(func, "n", i);
Py_DECREF(func);
- Py_DECREF(arg);
return res;
}