[New-bugs-announce] [issue24024] str.__doc__ needs an update

Marc-Andre Lemburg report at bugs.python.org
Wed Apr 22 15:13:46 CEST 2015

New submission from Marc-Andre Lemburg:

In Python 3.4.3, the doc string of the str() builtin still reads:

"str(object='') -> str\nstr(bytes_or_buffer[, encoding[, errors]]) -> str\n\nCreate a new string object from the given object. If encoding or\nerrors is specified, then the object must expose a data buffer\nthat will be decoded using the given encoding and error handler.\nOtherwise, returns the result of object.__str__() (if defined)\nor repr(object).\nencoding defaults to sys.getdefaultencoding().\nerrors defaults to 'strict'."

This no longer matches what str() does. sys.getdefaultencoding() always returns 'utf-8' and str() accepts bytes, bytearray or buffer-like objects as input when using an encoding, any object with .__str__() method defined or repr(obj) otherwise.

components: Interpreter Core, Unicode
messages: 241798
nosy: ezio.melotti, haypo, lemburg
priority: normal
severity: normal
status: open
title: str.__doc__ needs an update
versions: Python 3.4, Python 3.5, Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list