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.

classification
Title: Python 2.7 str.join documentation is incorrect
Type: behavior Stage: resolved
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Mariatta Nosy List: Malcolm Smith, Mariatta, cheryl.sabella, docs@python
Priority: normal Keywords: patch

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:57adminsetgithub: 76821
2018-01-26 17:55:48Mariattasetstatus: open -> closed
resolution: fixed
messages: + msg310779

stage: patch review -> resolved
2018-01-26 17:55:18Mariattasetmessages: + msg310778
2018-01-26 03:33:10Mariattasetmessages: + msg310729
2018-01-26 03:30:50Mariattasetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request5179
2018-01-25 17:26:23Mariattasetassignee: docs@python -> Mariatta
messages: + msg310690
2018-01-23 22:41:14cheryl.sabellasetnosy: + Mariatta, cheryl.sabella

messages: + msg310534
stage: needs patch
2018-01-23 21:32:21Malcolm Smithcreate