Issue 32640: Python 2.7 str.join documentation is incorrect (original) (raw)

Issue32640

Created on 2018-01-23 21:32 by Malcolm Smith, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 5333 merged Mariatta,2018-01-26 03:30
Messages (6)
msg310525 - (view) Author: Malcolm Smith (Malcolm Smith) Date: 2018-01-23 21:32
At some point the Python 3 documentation of str.join has been copied to Python 2. This includes the sentence "A TypeError will be raised if there are any non-string values in iterable, including bytes objects." The second half of this sentence is wrong for Python 2. Not only is there no "bytes" type in Python 2, but join() in this version will happily join any mixture of unicode and (byte-)str objects, producing unicode output if any of the items (or separator) were unicode. https://docs.python.org/2/library/stdtypes.html#str.join
msg310534 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-01-23 22:41
Looks like this happened in PR1898.
msg310690 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2018-01-25 17:26
Oops. Thanks, I will work on reverting the change later today.
msg310729 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2018-01-26 03:33
GH-5333 clarifies that str.join can return a Unicode object if iterable contains a Unicode object, and that it will raise TypeError if there is any non string or non unicode object.
msg310778 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2018-01-26 17:55
New changeset f5e8f71fe339fe5e47c4d24ac2e5177fa3c02922 by Mariatta in branch '2.7': [2.7] bpo-32640: Clarify the behavior of str.join and unicode object (GH-5333) https://github.com/python/cpython/commit/f5e8f71fe339fe5e47c4d24ac2e5177fa3c02922
msg310779 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2018-01-26 17:55
Thanks!
History
Date User Action Args
2022-04-11 14:58:57 admin set github: 76821
2018-01-26 17:55:48 Mariatta set status: open -> closedresolution: fixedmessages: + stage: patch review -> resolved
2018-01-26 17:55:18 Mariatta set messages: +
2018-01-26 03:33:10 Mariatta set messages: +
2018-01-26 03:30:50 Mariatta set keywords: + patchstage: needs patch -> patch reviewpull_requests: + <pull%5Frequest5179>
2018-01-25 17:26:23 Mariatta set assignee: docs@python -> Mariattamessages: +
2018-01-23 22:41:14 cheryl.sabella set nosy: + Mariatta, cheryl.sabellamessages: + stage: needs patch
2018-01-23 21:32:21 Malcolm Smith create