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 serhiy.storchaka
Recipients eryksun, ezio.melotti, lemburg, serhiy.storchaka, vstinner
Date 2015-04-22.13:43:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1429710216.43.0.46767600072.issue24025@psf.upfronthosting.co.za>
In-reply-to
Content
In Python 2, the unicode() constructor accepts bytes argument if it is decodeable with sys.getdefaultencoding().

>>> unicode(b'abc')
u'abc'
>>> import sys
>>> reload(sys)
<module 'sys' (built-in)>
>>> sys.setdefaultencoding("utf-8")
>>> unicode(u'abcäöü'.encode('utf-8'))
u'abc\xe4\xf6\xfc'

In Python 3, the str() constructor does not accept bytes arguments if Python is ran with -bb option.
History
Date User Action Args
2015-04-22 13:43:36serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, vstinner, ezio.melotti, eryksun
2015-04-22 13:43:36serhiy.storchakasetmessageid: <1429710216.43.0.46767600072.issue24025@psf.upfronthosting.co.za>
2015-04-22 13:43:36serhiy.storchakalinkissue24025 messages
2015-04-22 13:43:35serhiy.storchakacreate