[issue14744] Use _PyUnicodeWriter API in str.format() internals

STINNER Victor report at bugs.python.org
Tue May 8 00:19:42 CEST 2012


STINNER Victor <victor.stinner at gmail.com> added the comment:

Comments on the patch.

-PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj,
+PyAPI_FUNC(int) _PyComplex_FormatWriter(PyObject *obj,

Even if it is a private function, I prefer to rename it because its API does change.

/* Use the inlined version in unicodeobject.c */
#define _PyUnicodeWriter_prepare _PyUnicodeWriter_prepare_inline
#define _PyUnicodeWriter_write_substr _PyUnicodeWriter_write_substr_inline
#define _PyUnicodeWriter_write_str _PyUnicodeWriter_write_str_inline
#define _PyUnicodeWriter_write_char _PyUnicodeWriter_write_char_inline

Inlining may be removed to simplify the code (but inlining does speed up the code a little bit). Or the opposite: this code should be moved to a new "unicodewriterinline.h" file which would be included by unicodeobject.c and formatter_unicode.c.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14744>
_______________________________________


More information about the Python-bugs-list mailing list