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 docs@python, ezio.melotti, lemburg, martin.panter, serhiy.storchaka, vstinner
Date 2018-03-26.13:49:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1522072188.34.0.467229070634.issue24024@psf.upfronthosting.co.za>
In-reply-to
Content
The current docstring is correct. The signature str(object, encoding="utf-8", errors="strict") is not correct, because str(object) is not the same as str(object, encoding="utf-8", errors="strict").

>>> str([1, 2])
'[1, 2]'
>>> str([1, 2], encoding="utf-8", errors="strict")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: decoding to str: need a bytes-like object, list found
>>> str(b'abc')
__main__:1: BytesWarning: str() on a bytes instance
"b'abc'"
>>> str(b'abc', encoding="utf-8", errors="strict")
'abc'
History
Date User Action Args
2018-03-26 13:49:48serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, vstinner, ezio.melotti, docs@python, martin.panter
2018-03-26 13:49:48serhiy.storchakasetmessageid: <1522072188.34.0.467229070634.issue24024@psf.upfronthosting.co.za>
2018-03-26 13:49:48serhiy.storchakalinkissue24024 messages
2018-03-26 13:49:48serhiy.storchakacreate