[issue13706] non-ascii fill characters no longer work in numeric formatting

STINNER Victor report at bugs.python.org
Tue Jan 3 23:59:53 CET 2012


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

> I assume this is left over from the PEP 393 changes.

Correct.

> I'm not sure such a restriction needs to exist any more.

The restriction was introduced to simplify the implementation. maxchar has to be computed exactly in format_string_internal(), format_int_or_long_internal(), format_float_internal() and format_complex_internal().

For format_string_internal(), the following change is enough (untested):

    if (lpad != 0 || rpad != 0)
        maxchar = Py_MAX(maxchar, format->fill_char);

For number formatting functions, spec->n_lpadding, spec->n_spadding and spec->n_rpadding have to be checked. Something like:

    if (spec->n_lpadding || spec->n_spadding || spec->n_rpadding)
        maxchar = Py_MAX(maxchar, format->fill_char);

----------

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


More information about the Python-bugs-list mailing list