diff Objects/typeobject.c @ 62088:23ed837615aa

Merged revisions 81709-81710 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81709 | benjamin.peterson | 2010-06-04 19:56:46 -0500 (Fri, 04 Jun 2010) | 1 line implement object.__format__ with PyObject_Format ........ r81710 | benjamin.peterson | 2010-06-04 20:00:10 -0500 (Fri, 04 Jun 2010) | 1 line fix ref counting ........
author Benjamin Peterson <benjamin@python.org>
date Sat, 05 Jun 2010 01:03:24 +0000
parents 0bc8ffe6ba9a
children a7c8b4a6678b
line wrap: on
line diff
--- a/Objects/typeobject.c	Sat Jun 05 00:45:37 2010 +0000
+++ b/Objects/typeobject.c	Sat Jun 05 01:03:24 2010 +0000
@@ -3310,23 +3310,15 @@
     PyObject *format_spec;
     PyObject *self_as_str = NULL;
     PyObject *result = NULL;
-    PyObject *format_meth = NULL;
 
     if (!PyArg_ParseTuple(args, "U:__format__", &format_spec))
         return NULL;
 
     self_as_str = PyObject_Str(self);
-    if (self_as_str != NULL) {
-        /* 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);
-        }
-    }
+    if (self_as_str != NULL)
+        result = PyObject_Format(self_as_str, format_spec);
 
     Py_XDECREF(self_as_str);
-    Py_XDECREF(format_meth);
 
     return result;
 }