bpo-43651: PEP 597: Fix socket.makefile() (GH-25645)

This commit is contained in:
Inada Naoki 2021-04-27 13:16:28 +09:00 committed by GitHub
parent 743e2bae10
commit cfe523b492
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 3 deletions

View file

@ -337,6 +337,7 @@ class socket(_socket.socket):
buffer = io.BufferedWriter(raw, buffering)
if binary:
return buffer
encoding = io.text_encoding(encoding)
text = io.TextIOWrapper(buffer, encoding, errors, newline)
text.mode = mode
return text