8000 bpo-43651: PEP 597: Fix EncodingWarning in some tests by methane · Pull Request #25145 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-43651: PEP 597: Fix EncodingWarning in some tests #25145

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Apr 4, 2021
Merged
Prev Previous commit
Fix os.fdopen()
  • Loading branch information
methane committed Apr 3, 2021
commit 4ecbd81be8d7023c16b075609f3e7bdeed19902c
3 changes: 2 additions & 1 deletion Lib/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,8 @@ def fdopen(fd, mode="r", buffering=-1, encoding=None, *args, **kwargs):
if not isinstance(fd, int):
raise TypeError("invalid fd type (%s, expected integer)" % type(fd))
import io
encoding = io.text_encoding(encoding)
if "b" not in mode:
encoding = io.text_encoding(encoding)
return io.open(fd, mode, buffering, encoding, *args, **kwargs)


Expand Down
0