X Tutup
Skip to content

Commit 2299612

Browse files
committed
Cache encoding
1 parent 8aef6a7 commit 2299612

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

bpython/paste.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ def paste(self, s: str) -> Tuple[str, None]:
7979
stdout=subprocess.PIPE,
8080
)
8181
assert helper.stdin is not None
82-
helper.stdin.write(s.encode(getpreferredencoding()))
83-
output = helper.communicate()[0].decode(getpreferredencoding())
82+
encoding = getpreferredencoding()
83+
helper.stdin.write(s.encode(encoding))
84+
output = helper.communicate()[0].decode(encoding)
8485
paste_url = output.split()[0]
8586
except OSError as e:
8687
if e.errno == errno.ENOENT:

0 commit comments

Comments
 (0)
X Tutup