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.

Title: Input and Output tutorial erroneously references default encoding UTF-8
Type: Stage: needs patch
Components: Documentation, IO Versions: Python 3.6, Python 3.4, Python 3.5
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: acucci, docs@python, jaraco, python-dev, r.david.murray, willingc
Priority: normal Keywords: easy, patch

Created on 2015-07-26 15:20 by jaraco, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
issue24729.patch acucci, 2015-07-26 17:08 Patch review
issue24729_v2.patch acucci, 2015-07-28 18:06 Patch v2 review
issue24729_v3.patch acucci, 2015-07-28 19:01 Patch v3 review
issue24729_v4.patch acucci, 2015-07-29 17:55 Patch v4 review
issue24729_v4.patch acucci, 2015-07-29 17:58 review
Messages (11)
msg247433 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2015-07-26 15:20
In Doc/tutorial/inputoutput.rst, the docs state this about opening a file:

 Normally, files are opened in :dfn:`text mode`, that means, you read and write
 strings from and to the file, which are encoded in a specific encoding (the
 default being UTF-8).

That statement is directly contradicted by the docs for open (Doc/library/functions.rst) which indicate:

 In text mode, if encoding is not specified the encoding used is platform
 dependent: locale.getpreferredencoding(False) is called to get the current
 locale encoding.

The implementation matches the latter indication.
msg247440 - (view) Author: Alessandro Cucci (acucci) * Date: 2015-07-26 17:08
msg247478 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-07-27 18:31
Hmm.  It's a tutorial.  It would probably be better to just say "the default is platform dependent" with a link to the open docs.
msg247534 - (view) Author: Alessandro Cucci (acucci) * Date: 2015-07-28 18:06
@r.david.murray: just like that? (see patch v2)
msg247536 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-07-28 18:22
A direct link to open would be better ("see :func:``" should do it, I think).
msg247539 - (view) Author: Alessandro Cucci (acucci) * Date: 2015-07-28 19:01
tried again :)
msg247540 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-07-28 19:38
Looks good to me assuming it renders correctly.
msg247546 - (view) Author: Carol Willing (willingc) * (Python committer) Date: 2015-07-28 22:14
@acucci and R. David Murray: I've run the patch locally, and all renders well except for one link.

@acucci: I believe that the direct link to the `open()` command should be

... "see :func:`open` "

An example exists at the beginning of the section containing this line. The command in the current patch renders as plain text and not a link. If you can fix this small issue, the patch should be ready to merge (pending R David Murray's agreement). Thanks!
msg247589 - (view) Author: Alessandro Cucci (acucci) * Date: 2015-07-29 17:55
ok, this time I tested the render myself and seems ok. For rendering I used sphinx. Sorry if I didn't try the final result in the first time, but I've never had the chance to use rst files before.
msg247597 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-07-29 18:30
New changeset c9e78d91d588 by Alessandro Cucci in branch '3.4':
Issue #24729: Update tutorial to match implementation.

New changeset 20084be60761 by Jason R. Coombs in branch '3.4':
Issue #24729: Correct reference to open function.

New changeset 575e60ed7cb8 by Jason R. Coombs in branch '3.5':
Merge with 3.4 for Issue #24729

New changeset 47330144debd by Jason R. Coombs in branch 'default':
Merge with 3.5 for Issue #24729
msg247598 - (view) Author: Jason R. Coombs (jaraco) * (Python committer) Date: 2015-07-29 18:31
Thanks for working through this Alessandro. I've applied your v3 patch and added a subsequent commit 20084be60761 to correct the open reference.
Date User Action Args
2022-04-11 14:58:19adminsetgithub: 68917
2015-07-29 18:31:19jaracosetstatus: open -> closed
resolution: fixed
messages: + msg247598
2015-07-29 18:30:07python-devsetnosy: + python-dev
messages: + msg247597
2015-07-29 17:58:27acuccisetfiles: + issue24729_v4.patch
2015-07-29 17:55:32acuccisetfiles: + issue24729_v4.patch

messages: + msg247589
2015-07-28 22:14:50willingcsetnosy: + willingc

messages: + msg247546
stage: commit review -> needs patch
2015-07-28 19:38:19r.david.murraysetmessages: + msg247540
stage: commit review
2015-07-28 19:01:59acuccisetfiles: + issue24729_v3.patch

messages: + msg247539
2015-07-28 18:22:43r.david.murraysetmessages: + msg247536
2015-07-28 18:06:27acuccisetfiles: + issue24729_v2.patch

messages: + msg247534
2015-07-27 18:31:08r.david.murraysetnosy: + r.david.murray
messages: + msg247478
2015-07-26 17:08:42acuccisetfiles: + issue24729.patch

nosy: + acucci
messages: + msg247440

keywords: + patch
2015-07-26 15:20:36jaracosetkeywords: + easy
2015-07-26 15:20:18jaracocreate