You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Exception using fileinput.hook_compressed in binary mode #101961
When using the fileinput.hook_compressed hook in binary mode in the case that the file is not compressed, an exception is raised instead of processing the file like normal.
$ python3.10 fileinput_cat.py fileinput_cat.pyTraceback (most recent call last): File "fileinput_bug.py", line 5, in <module> for line in f: File ".../lib/python3.10/fileinput.py", line 256, in __next__ line = self._readline() File ".../lib/python3.10/fileinput.py", line 385, in _readline self._file = self._openhook(self._filename, self._mode) File ".../lib/python3.10/fileinput.py", line 432, in hook_compressed return open(filename, mode, encoding=encoding, errors=errors)ValueError: binary mode doesn't take an encoding argument
Your environment
I tried this on Python 3.10.9 (installed from nixpkgs) on Intel macOS 11.7.3. It was working on Python 3.9.16.
Activity
corona10 commentedon Feb 18, 2023
I will take the issue as the internal OSS sprint for the new contributors.
I will delegate the issue to my mentees.
Thanks for understanding!
0x1306e6d commentedon Feb 20, 2023
I'm looking this issue 👀
pythongh-101961 Do not pass encoding if binary mode
pythongh-101961 Update `Misc/ACKS`
gh-101961 fileinput.hookcompressed should not set the encoding value …
pythongh-101961 fileinput.hookcompressed should not set the encoding …
pythongh-101961 fileinput.hookcompressed should not set the encoding …
[3.10] gh-101961 fileinput.hookcompressed should not set the encoding…
[3.11] gh-101961 fileinput.hookcompressed should not set the encoding…
corona10 commentedon Feb 21, 2023
Thank you @ghkim3221 for the hard work!
Merge branch 'main' into lockfreecp
pythongh-101961 fileinput.hookcompressed should not set the encoding …
pythongh-101961 fileinput.hookcompressed should not set the encoding …
pythongh-101961 fileinput.hookcompressed should not set the encoding …