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 gregory.p.smith
Recipients gregory.p.smith, serhiy.storchaka
Date 2013-10-04.21:08:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1380920919.89.0.913111543332.issue19159@psf.upfronthosting.co.za>
In-reply-to
Content
Correct, my characterization above was wrong (I shouldn't write these up without the interpreter right in front of me). What is wrong with the conversion is:

unicode("", "utf-8") in python 2.x should become either str(b"", "utf-8") or, better, just "" in Python 3.x.  The better version could be done if the codec and value can be represented in the encoding of the output 3.x source code file as is but that optimization is not critical.

In order for str() to take a second arg (the codec) the first cannot be a unicode string already:

>>> str("foo", "utf-8")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: decoding str is not supported
History
Date User Action Args
2013-10-04 21:08:39gregory.p.smithsetrecipients: + gregory.p.smith, serhiy.storchaka
2013-10-04 21:08:39gregory.p.smithsetmessageid: <1380920919.89.0.913111543332.issue19159@psf.upfronthosting.co.za>
2013-10-04 21:08:39gregory.p.smithlinkissue19159 messages
2013-10-04 21:08:39gregory.p.smithcreate