]> granicus.if.org Git - python/commit
Add a format specifier %R to PyUnicode_FromFormat(), which embeds
authorWalter Dörwald <walter@livinglogic.de>
Sat, 19 May 2007 21:49:49 +0000 (21:49 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Sat, 19 May 2007 21:49:49 +0000 (21:49 +0000)
commit7569dfe11d51a11bfb11002d31245b889916fb11
tree7e4cbbb7a27a366ea0cdc8eeacc05a23f649e4cd
parent94b59bb14474b6fe5a272a2c60b65f8375e827b3
Add a format specifier %R to PyUnicode_FromFormat(), which embeds
the result of a call to PyObject_Repr() into the string. This makes
it possible to simplify many repr implementations.

PyUnicode_FromFormat() uses two steps to create the final string: A first
pass through the format string determines the size of the final string and
a second pass creates the string. To avoid calling PyObject_Repr() twice
for each %R specifier, PyObject_Repr() is called during the size
calculation step and the results are stored in an array (whose size is
determined at the start by counting %R specifiers).
12 files changed:
Modules/_collectionsmodule.c
Modules/_elementtree.c
Modules/_tkinter.c
Modules/arraymodule.c
Modules/datetimemodule.c
Modules/itertoolsmodule.c
Objects/classobject.c
Objects/exceptions.c
Objects/intobject.c
Objects/setobject.c
Objects/sliceobject.c
Objects/unicodeobject.c