Author vstinner
Recipients doerwalter, eric.smith, ezio.melotti, pablomouzo, vstinner
Date 2010-03-09.23:44:31
SpamBayes Score 6.6651e-10
Marked as misclassified No
Message-id <>
*Draft* patch fixing the issue: render_field() raises an error if the argument is an unicode argument, string_format() catchs this error and converts self to unicode and call unicode.format(*args, **kw).


    # self.format() raises an error if any argument is 
    # an unicode string)
    return self.format(*args,**kw)
 except UnicodeError:
    unicode = self.decode(default_encoding)
    return unicode.format(*args, **kw)

The patch changes the result type of '{}'.format(u'ascii'): it was str and it becomes unicode. The new behaviour is consistent with "%s" % u"ascii" => u"ascii" (unicode).

I'm not sure that catching *any* unicode error is a good idea. I think that it would be better to use a new exception type dedicated to this issue, but it looks complex to define a new exception. I will may do it for the next patch version ;-)
Date User Action Args
2010-03-09 23:44:37vstinnersetrecipients: + vstinner, doerwalter, eric.smith, ezio.melotti, pablomouzo
2010-03-09 23:44:36vstinnersetmessageid: <>
2010-03-09 23:44:34vstinnerlinkissue7300 messages
2010-03-09 23:44:34vstinnercreate