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.

Author berker.peksag
Recipients berker.peksag, natgaertner, serhiy.storchaka
Date 2019-05-12.11:40:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1557661200.34.0.643594993165.issue36865@roundup.psfhosted.org>
In-reply-to
Content
Thank you for the report and the PR!

I think accepting 'rt' mode is a good idea. However, it's a new feature and it can only go into 3.8.

It seems to me that the root cause of the issue is that the fileinput module wasn't properly converted to support Python 3. Perhaps we could change 'r' to 'rt' in FileInput.__init__() or hook_compressed() to make it work properly, so the example in issue 5758 would work as expected without changing any user code:

# test.py

import fileinput

for line in fileinput.FileInput(openhook=fileinput.hook_compressed):
    print(line.rstrip())


$ ./python.exe test.py mike.txt mike.txt.gz
Hello from Mike.
This is the second line.
Why did the robot cross the road?
Hello from Mike.
This is the second line.
Why did the robot cross the road?
History
Date User Action Args
2019-05-12 11:40:00berker.peksagsetrecipients: + berker.peksag, serhiy.storchaka, natgaertner
2019-05-12 11:40:00berker.peksagsetmessageid: <1557661200.34.0.643594993165.issue36865@roundup.psfhosted.org>
2019-05-12 11:40:00berker.peksaglinkissue36865 messages
2019-05-12 11:40:00berker.peksagcreate