[Python-checkins] r81709 - python/trunk/Objects/typeobject.c
benjamin.peterson
python-checkins at python.org
Sat Jun 5 02:56:46 CEST 2010
Author: benjamin.peterson
Date: Sat Jun 5 02:56:46 2010
New Revision: 81709
Log:
implement object.__format__ with PyObject_Format
Modified:
python/trunk/Objects/typeobject.c
Modified: python/trunk/Objects/typeobject.c
==============================================================================
--- python/trunk/Objects/typeobject.c (original)
+++ python/trunk/Objects/typeobject.c Sat Jun 5 02:56:46 2010
@@ -3413,7 +3413,6 @@
PyObject *format_spec;
PyObject *self_as_str = NULL;
PyObject *result = NULL;
- PyObject *format_meth = NULL;
Py_ssize_t format_len;
if (!PyArg_ParseTuple(args, "O:__format__", &format_spec))
@@ -3449,21 +3448,11 @@
goto done;
*/
}
-
- /* find the format function */
- format_meth = PyObject_GetAttrString(self_as_str,
- "__format__");
- if (format_meth != NULL) {
- /* and call it */
- result = PyObject_CallFunctionObjArgs(format_meth,
- format_spec,
- NULL);
- }
+ return PyObject_Format(self_as_str, format_spec);
}
done:
Py_XDECREF(self_as_str);
- Py_XDECREF(format_meth);
return result;
}
More information about the Python-checkins
mailing list