]> granicus.if.org Git - python/commit
Issue #15609: Optimize str%args for integer argument
authorVictor Stinner <victor.stinner@gmail.com>
Mon, 1 Oct 2012 22:33:47 +0000 (00:33 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Mon, 1 Oct 2012 22:33:47 +0000 (00:33 +0200)
commit621ef3d84f842a10dc9cb2af5ab9555b1663b79e
tree8f7553021772f75f5abb239eeee36246aabf6319
parentfd0d3e5d25cf9dcb751a329cf390388e0dbd8da2
Issue #15609: Optimize str%args for integer argument

 - Use _PyLong_FormatWriter() instead of formatlong() when possible, to avoid
   a temporary buffer
 - Enable the fast path when width is smaller or equals to the length,
   and when the precision is bigger or equals to the length
 - Add unit tests!
 - formatlong() uses PyUnicode_Resize() instead of _PyUnicode_FromASCII()
   to resize the output string
Lib/test/test_format.py
Objects/unicodeobject.c
Python/formatter_unicode.c