diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-10-08 11:51:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-08 11:51:16 (GMT) |
commit | a1f45008f190b0d340ec0eac623f05ef98e6b4c9 (patch) | |
tree | 6170ac955be225a7073b4c0d150130afdf63375a /Lib/idlelib/pyshell.py | |
parent | aa9d5b8ec33fd647ed9a0fe113e60ff826bea49a (diff) | |
download | cpython-a1f45008f190b0d340ec0eac623f05ef98e6b4c9.zip cpython-a1f45008f190b0d340ec0eac623f05ef98e6b4c9.tar.gz cpython-a1f45008f190b0d340ec0eac623f05ef98e6b4c9.tar.bz2 |
bpo-36698: IDLE no longer fails when write non-encodable characters to stderr. (GH-16583)
It now escapes them with a backslash, as the regular Python interpreter.
Added the "errors" field to the standard streams.
(cherry picked from commit b690a2759e62d9ee0b6ea1b20e8f7e4b2cdbf8bb)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Diffstat (limited to 'Lib/idlelib/pyshell.py')
-rwxr-xr-x | Lib/idlelib/pyshell.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Lib/idlelib/pyshell.py b/Lib/idlelib/pyshell.py index bc87d24..065122d 100755 --- a/Lib/idlelib/pyshell.py +++ b/Lib/idlelib/pyshell.py @@ -54,7 +54,7 @@ from idlelib.editor import EditorWindow, fixwordbreaks from idlelib.filelist import FileList from idlelib.outwin import OutputWindow from idlelib import rpc -from idlelib.run import idle_formatwarning, PseudoInputFile, PseudoOutputFile +from idlelib.run import idle_formatwarning, StdInputFile, StdOutputFile from idlelib.undo import UndoDelegator HOST = '127.0.0.1' # python execution server on localhost loopback @@ -902,10 +902,14 @@ class PyShell(OutputWindow): self.save_stderr = sys.stderr self.save_stdin = sys.stdin from idlelib import iomenu - self.stdin = PseudoInputFile(self, "stdin", iomenu.encoding) - self.stdout = PseudoOutputFile(self, "stdout", iomenu.encoding) - self.stderr = PseudoOutputFile(self, "stderr", iomenu.encoding) - self.console = PseudoOutputFile(self, "console", iomenu.encoding) + self.stdin = StdInputFile(self, "stdin", + iomenu.encoding, iomenu.errors) + self.stdout = StdOutputFile(self, "stdout", + iomenu.encoding, iomenu.errors) + self.stderr = StdOutputFile(self, "stderr", + iomenu.encoding, "backslashreplace") + self.console = StdOutputFile(self, "console", + iomenu.encoding, iomenu.errors) if not use_subprocess: sys.stdout = self.stdout sys.stderr = self.stderr |