This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Aleksey.Sivokon
Recipients Aleksey.Sivokon
Date 2012-09-16.11:55:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Expected behavior of string.Formatter() is to return unicode strings for unicode templates, and "byte" strings for str templates. Which is exactly what it does, with one frustrating exception: for empty unicode string it returns byte str. Test follows:

import string
template = u""
result = string.Formatter().format(template)
assert isinstance(result, unicode)
# AssertionError
Date User Action Args
2012-09-16 11:55:56Aleksey.Sivokonsetrecipients: + Aleksey.Sivokon
2012-09-16 11:55:56Aleksey.Sivokonsetmessageid: <>
2012-09-16 11:55:56Aleksey.Sivokonlinkissue15951 messages
2012-09-16 11:55:55Aleksey.Sivokoncreate