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: fileinput module should document that openhook and mode are ignored when reading from stdin
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.8, Python 3.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, ezio.melotti, grantwu, mangrisano, matrixise
Priority: normal Keywords: easy, patch

Created on 2019-05-22 17:26 by Grant Wu2, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 13545 merged mangrisano, 2019-05-24 12:19
PR 13753 merged miss-islington, 2019-06-02 21:02
Messages (7)
msg343221 - (view) Author: Grant Wu (deprecated) (Grant Wu2) Date: 2019-05-22 17:26
https://github.com/python/cpython/blob/master/Lib/fileinput.py#L326 shows that the openhook and mode are ignored when reading from stdin.

Since part of fileinput's functionality is to abstract over whether one is reading from stdin or over a file, I think this abstraction leak should be documented.  One common use case where this might break is when attempting to set the file encoding using the included fileinput.hook_encoded functionality.
msg343282 - (view) Author: Stéphane Wirtel (matrixise) * (Python committer) Date: 2019-05-23 08:01
Hi Grant,

Thank you for your bug report,

Would you interested to propose a Pull Request for a fix? You can read the devguide for more info https://devguide.python.org/

Thank you
msg343356 - (view) Author: Michele Angrisano (mangrisano) * Date: 2019-05-24 09:05
The Python's version chosen for this issue is 3.7. I think the suggest can be useful for 3.8 as well. Am I right?
msg343382 - (view) Author: Michele Angrisano (mangrisano) * Date: 2019-05-24 12:19
I've just made a PR for this issue.
msg344316 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2019-06-02 21:01
New changeset aca273e2401ca3151e15e984f400233b7f255e15 by Ezio Melotti (Michele Angrisano) in branch 'master':
bpo-37014: Update docstring and Documentation of fileinput.FileInput(). (GH-13545)
https://github.com/python/cpython/commit/aca273e2401ca3151e15e984f400233b7f255e15
msg344325 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2019-06-02 21:36
New changeset 6bd438e137a0618b8db949a4751304f541b6674d by Ezio Melotti (Miss Islington (bot)) in branch '3.7':
bpo-37014: Update docstring and Documentation of fileinput.FileInput(). (GH-13545) (GH-13753)
https://github.com/python/cpython/commit/6bd438e137a0618b8db949a4751304f541b6674d
msg344326 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2019-06-02 21:43
Fixed, thanks for the report and the PRs!
History
Date User Action Args
2022-04-11 14:59:15adminsetgithub: 81195
2019-06-02 21:43:10ezio.melottisetstatus: open -> closed

title: [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin -> fileinput module should document that openhook and mode are ignored when reading from stdin
messages: + msg344326
versions: + Python 3.8
type: enhancement
resolution: fixed
stage: patch review -> resolved
2019-06-02 21:36:37ezio.melottisetmessages: + msg344325
2019-06-02 21:02:03miss-islingtonsetpull_requests: + pull_request13634
2019-06-02 21:01:52ezio.melottisetnosy: + ezio.melotti
messages: + msg344316
2019-05-24 12:19:56mangrisanosetmessages: + msg343382
2019-05-24 12:19:09mangrisanosetkeywords: + patch
stage: patch review
pull_requests: + pull_request13457
2019-05-24 09:05:56mangrisanosetnosy: + mangrisano
messages: + msg343356
2019-05-23 16:00:10Grant Wu2setnosy: + grantwu, - Grant Wu2
2019-05-23 08:01:26matrixisesetkeywords: + easy
2019-05-23 08:01:14matrixisesetnosy: + matrixise

messages: + msg343282
title: fileinput module should document that openhook and mode are ignored when reading from stdin -> [First easy issue] fileinput module should document that openhook and mode are ignored when reading from stdin
2019-05-22 17:26:07Grant Wu2create