[Python-checkins] r46415 - python/trunk/Objects/classobject.c

georg.brandl python-checkins at python.org
Fri May 26 22:22:51 CEST 2006


Author: georg.brandl
Date: Fri May 26 22:22:50 2006
New Revision: 46415

Modified:
   python/trunk/Objects/classobject.c
Log:
Simplify calling.



Modified: python/trunk/Objects/classobject.c
==============================================================================
--- python/trunk/Objects/classobject.c	(original)
+++ python/trunk/Objects/classobject.c	Fri May 26 22:22:50 2006
@@ -1072,21 +1072,15 @@
 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;
 }
 


More information about the Python-checkins mailing list