Refactor and clean up str.format() code (and helpers) in advance of optimizations.
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 08e767e..10d03ae 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -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));
}