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: Clarify pathlib.Path("filepath").read_text()
Type: Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: CuriousLearner, docs@python, miss-islington, terry.reedy, thomas.nyberg, xtreak
Priority: normal Keywords: patch

Created on 2018-08-02 11:52 by thomas.nyberg, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8645 merged xtreak, 2018-08-03 04:52
PR 8694 merged miss-islington, 2018-08-06 19:55
PR 8695 merged miss-islington, 2018-08-06 19:55
Messages (8)
msg322947 - (view) Author: Thomas Nyberg (thomas.nyberg) * Date: 2018-08-02 11:52
This came out of the following posts:

https://mail.python.org/pipermail/python-ideas/2018-August/052549.html
https://mail.python.org/pipermail/python-ideas/2018-August/052553.html

Basically my request would be to change the documentation here:

https://docs.python.org/3.7/library/pathlib.html#pathlib.Path.read_text

I would like to add a note that the underlying file object itself is closed after the read_text() method is called. Maybe I'm just a little dense and it should be obvious that the functionality here would be different than open("filepath").read(), but given that thread I linked, I don't believe I'm the only one.
msg322991 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-02 20:11
How about if we add "The file is opened and then closed." before "The optional parameters have the same meaning as in open()."
msg323033 - (view) Author: Thomas Nyberg (thomas.nyberg) * Date: 2018-08-03 06:51
For what it's worth as the original opener of the bug report, I think Terry's recommendation clarifies things quite well.
msg323152 - (view) Author: Sanyam Khurana (CuriousLearner) * (Python triager) Date: 2018-08-05 14:25
+1 to Terry's suggestion.

I've reviewed xtreak's PR and it looks good to me.
msg323219 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-08-06 19:55
New changeset 5b2657fb8c5aaa98e5748e1c325c74b97ea12fd1 by Terry Jan Reedy (Xtreak) in branch 'master':
bpo-34319: Clarify file handler closure in pathlib.read_text (GH-8645)
https://github.com/python/cpython/commit/5b2657fb8c5aaa98e5748e1c325c74b97ea12fd1
msg323220 - (view) Author: miss-islington (miss-islington) Date: 2018-08-06 19:59
New changeset 1c6df83e9318ab4ef8e32b805b8226b1324e1ffd by Miss Islington (bot) in branch '3.7':
bpo-34319: Clarify file handler closure in pathlib.read_text (GH-8645)
https://github.com/python/cpython/commit/1c6df83e9318ab4ef8e32b805b8226b1324e1ffd
msg323221 - (view) Author: miss-islington (miss-islington) Date: 2018-08-06 20:04
New changeset 3da5c5c76d90ddfc4c188cc801d9387501b63b7f by Miss Islington (bot) in branch '3.6':
bpo-34319: Clarify file handler closure in pathlib.read_text (GH-8645)
https://github.com/python/cpython/commit/3da5c5c76d90ddfc4c188cc801d9387501b63b7f
msg324145 - (view) Author: Sanyam Khurana (CuriousLearner) * (Python triager) Date: 2018-08-27 04:18
Marking this bug as fixed via https://github.com/python/cpython/pull/8645
History
Date User Action Args
2022-04-11 14:59:04adminsetgithub: 78500
2018-08-27 04:18:01CuriousLearnersetstatus: open -> closed
resolution: fixed
messages: + msg324145

stage: patch review -> resolved
2018-08-06 20:04:33miss-islingtonsetmessages: + msg323221
2018-08-06 19:59:45miss-islingtonsetnosy: + miss-islington
messages: + msg323220
2018-08-06 19:55:55miss-islingtonsetpull_requests: + pull_request8189
2018-08-06 19:55:45miss-islingtonsetpull_requests: + pull_request8188
2018-08-06 19:55:06terry.reedysetmessages: + msg323219
2018-08-05 14:25:48CuriousLearnersetnosy: + CuriousLearner
messages: + msg323152
2018-08-03 06:51:45thomas.nybergsetmessages: + msg323033
2018-08-03 04:52:37xtreaksetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request8148
2018-08-02 20:11:08terry.reedysetversions: + Python 3.6, Python 3.7, Python 3.8
nosy: + terry.reedy

messages: + msg322991

stage: needs patch
2018-08-02 12:28:44xtreaksetnosy: + xtreak
2018-08-02 11:52:33thomas.nybergcreate