summaryrefslogtreecommitdiffstats
path: root/Objects/longobject.c
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2008-05-30 18:10:19 (GMT)
committerEric Smith <eric@trueblade.com>2008-05-30 18:10:19 (GMT)
commit4a7d76ddb51422e2adb0fb56afa5b82162837e52 (patch)
tree266a1c326d040ce45be22c4c785edec2f7f67f02 /Objects/longobject.c
parenteb2c964aeb0ab0e3e01560c955cab95f8e3b92c2 (diff)
downloadcpython-4a7d76ddb51422e2adb0fb56afa5b82162837e52.zip
cpython-4a7d76ddb51422e2adb0fb56afa5b82162837e52.tar.gz
cpython-4a7d76ddb51422e2adb0fb56afa5b82162837e52.tar.bz2
Refactor and clean up str.format() code (and helpers) in advance of optimizations.
Diffstat (limited to 'Objects/longobject.c')
-rw-r--r--Objects/longobject.c13
1 files changed, 7 insertions, 6 deletions
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 @@ long_getN(PyLongObject *v, void *context) {
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));
}