mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Refactor and clean up str.format() code (and helpers) in advance of optimizations.
This commit is contained in:
parent
eb2c964aeb
commit
4a7d76ddb5
10 changed files with 98 additions and 99 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue