Author vstinner
Recipients doerwalter, eric.smith, ezio.melotti, pablomouzo, vstinner
Date 2010-03-09.22:57:45
SpamBayes Score 0.000409523
Marked as misclassified No
Message-id <1268175467.92.0.848495415813.issue7300@psf.upfronthosting.co.za>
In-reply-to
Content
PyString_Format() uses a "goto unicode;" if a '%c' or '%s' argument is unicode. The unicode label converts the partial formatted result (byte string) to unicode, and use PyUnicode_Format() to finish to formatting.

I don't think that you can apply the same algorithm here (converts the partial result to unicode) because it requires to rewrite the format string: arguments can be used twice or more, and used in any order.

Example: "{0} {1}".format("bytes", u"unicode") => switch to unicode occurs at result="bytes ", format=" {1}", arguments=(u"unicode"). Converts "bytes " to unicode is easy, but the format have to be rewritten in " {0}" or something else.

Call trace of str.format(): do_string_format() -> build_string() -> output_markup() -> render_field(). The argument type is proceed in render_field().
History
Date User Action Args
2010-03-09 22:57:48vstinnersetrecipients: + vstinner, doerwalter, eric.smith, ezio.melotti, pablomouzo
2010-03-09 22:57:47vstinnersetmessageid: <1268175467.92.0.848495415813.issue7300@psf.upfronthosting.co.za>
2010-03-09 22:57:46vstinnerlinkissue7300 messages
2010-03-09 22:57:45vstinnercreate