summaryrefslogtreecommitdiff
path: root/Tools/idle/PyShell.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-08-10 12:22:12 +0000
committerMartin v. Löwis <martin@v.loewis.de>2002-08-10 12:22:12 +0000
commit75ea1e11dcb90c768af6a222ae8e20a4f532617d (patch)
treefe1c3b7ac1e5e7876b0daa799056bd6032147c52 /Tools/idle/PyShell.py
parent3ddb856ed1fcfbfb750b00a60b9a5df76555751e (diff)
downloadcpython-git-75ea1e11dcb90c768af6a222ae8e20a4f532617d.tar.gz
Convert characters from the locale's encoding on output.
Reject characters outside the locale's encoding on input.
Diffstat (limited to 'Tools/idle/PyShell.py')
-rw-r--r--Tools/idle/PyShell.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Tools/idle/PyShell.py b/Tools/idle/PyShell.py
index 31a89402cf..e71a9a17a5 100644
--- a/Tools/idle/PyShell.py
+++ b/Tools/idle/PyShell.py
@@ -191,7 +191,12 @@ class ModifiedInterpreter(InteractiveInterpreter):
warnings.filterwarnings(action="error", category=SyntaxWarning)
if isinstance(source, types.UnicodeType):
import IOBinding
- source = source.encode(IOBinding.encoding)
+ try:
+ source = source.encode(IOBinding.encoding)
+ except UnicodeError:
+ self.tkconsole.resetoutput()
+ self.write("Unsupported characters in input")
+ return
try:
return InteractiveInterpreter.runsource(self, source, filename)
finally: