[issue28307] Accelerate 'string' % (value, ...) by using formatted string literals

STINNER Victor report at bugs.python.org
Wed Sep 22 09:56:33 EDT 2021


STINNER Victor <vstinner at python.org> added the comment:

commit a0bd9e9c11f5f52c7ddd19144c8230da016b53c6
Author: Serhiy Storchaka <storchaka at gmail.com>
Date:   Sat May 8 22:33:10 2021 +0300

    bpo-28307: Convert simple C-style formatting with literal format into f-string. (GH-5012)
    
    C-style formatting with literal format containing only format codes
    %s, %r and %a (with optional width, precision and alignment)
    will be converted to an equivalent f-string expression.
    
    It can speed up formatting more than 2 times by eliminating
    runtime parsing of the format string and creating temporary tuple.

commit 8b010673185d36d13e69e5bf7d902a0b3fa63051
Author: Serhiy Storchaka <storchaka at gmail.com>
Date:   Sun May 23 19:06:48 2021 +0300

    bpo-28307: Tests and fixes for optimization of C-style formatting (GH-26318)
    
    Fix errors:
    * "%10.s" should be equal to "%10.0s", not "%10s".
    * Tuples with starred expressions caused a SyntaxError.

----------
nosy: +vstinner

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue28307>
_______________________________________


More information about the Python-bugs-list mailing list