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 chris.jerdonek
Recipients Aleksey.Sivokon, chris.jerdonek, eric.smith, r.david.murray
Date 2012-09-19.00:38:51
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1348015134.92.0.914227288563.issue15951@psf.upfronthosting.co.za>
In-reply-to
Content
Attached is a proposed patch.

Some explanation behind the patch that stems from the above comments:

The following is an example of Formatter.format() returning str in the current implementation that would break if we made Formatter.format() return unicode whenever format_string is unicode:

>>> f.format(u"{0}", "\xc3\xa9")  # UTF-8 encoded "e-acute".
'\xc3\xa9'

(It would break with a UnicodeDecodeError because 'ascii' is the default encoding.)

Since we can't change Formatter.format(format_string) to return unicode whenever format_string is unicode without breaking existing code, I believe the best we can do is to document the departure from PEP 3101.  Since the caller has to handle return values of type str anyways, I don't think it helps to ensure that more return values are unicode.
History
Date User Action Args
2012-09-19 00:38:55chris.jerdoneksetrecipients: + chris.jerdonek, eric.smith, r.david.murray, Aleksey.Sivokon
2012-09-19 00:38:54chris.jerdoneksetmessageid: <1348015134.92.0.914227288563.issue15951@psf.upfronthosting.co.za>
2012-09-19 00:38:54chris.jerdoneklinkissue15951 messages
2012-09-19 00:38:53chris.jerdonekcreate