Mercurial > cpython-lru_cache-weakref
diff Objects/longobject.c @ 47393:0da27fdf0192
Refactor and clean up str.format() code (and helpers) in advance of optimizations.
| author | Eric Smith <eric@trueblade.com> |
|---|---|
| date | Fri, 30 May 2008 18:10:19 +0000 |
| parents | 23ab586c427a |
| children | 58f4b60773fe |
line wrap: on
line diff
--- a/Objects/longobject.c Fri May 30 12:05:02 2008 +0000 +++ b/Objects/longobject.c Fri May 30 18:10:19 2008 +0000 @@ -5,8 +5,6 @@ #include "Python.h" #include "longintrepr.h" -#include "formatter_unicode.h" - #include <ctype.h> #ifndef NSMALLPOSINTS @@ -3590,10 +3588,13 @@ static PyObject * long__format__(PyObject *self, PyObject *args) { - /* when back porting this to 2.6, check type of the format_spec - and call either unicode_long__format__ or - string_long__format__ */ - return unicode_long__format__(self, args); + PyObject *format_spec; + + if (!PyArg_ParseTuple(args, "U:__format__", &format_spec)) + return NULL; + return _PyLong_FormatAdvanced(self, + PyUnicode_AS_UNICODE(format_spec), + PyUnicode_GET_SIZE(format_spec)); }
