Commit 4b2c468e authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #15809: IDLE shell now uses locale encoding instead of Latin1 for

decoding unicode literals.
parent c8059e48
...@@ -34,6 +34,7 @@ from idlelib import rpc ...@@ -34,6 +34,7 @@ from idlelib import rpc
from idlelib import Debugger from idlelib import Debugger
from idlelib import RemoteDebugger from idlelib import RemoteDebugger
from idlelib import macosxSupport from idlelib import macosxSupport
from idlelib import IOBinding
IDENTCHARS = string.ascii_letters + string.digits + "_" IDENTCHARS = string.ascii_letters + string.digits + "_"
HOST = '127.0.0.1' # python execution server on localhost loopback HOST = '127.0.0.1' # python execution server on localhost loopback
...@@ -668,10 +669,11 @@ class ModifiedInterpreter(InteractiveInterpreter): ...@@ -668,10 +669,11 @@ class ModifiedInterpreter(InteractiveInterpreter):
self.more = 0 self.more = 0
self.save_warnings_filters = warnings.filters[:] self.save_warnings_filters = warnings.filters[:]
warnings.filterwarnings(action="error", category=SyntaxWarning) warnings.filterwarnings(action="error", category=SyntaxWarning)
if isinstance(source, unicode): if isinstance(source, unicode) and IOBinding.encoding != 'utf-8':
from idlelib import IOBinding
try: try:
source = source.encode(IOBinding.encoding) source = '# -*- coding: %s -*-\n%s' % (
IOBinding.encoding,
source.encode(IOBinding.encoding))
except UnicodeError: except UnicodeError:
self.tkconsole.resetoutput() self.tkconsole.resetoutput()
self.write("Unsupported characters in input\n") self.write("Unsupported characters in input\n")
......
...@@ -210,6 +210,8 @@ def cleanup_traceback(tb, exclude): ...@@ -210,6 +210,8 @@ def cleanup_traceback(tb, exclude):
fn, ln, nm, line = tb[i] fn, ln, nm, line = tb[i]
if nm == '?': if nm == '?':
nm = "-toplevel-" nm = "-toplevel-"
if fn.startswith("<pyshell#") and IOBinding.encoding != 'utf-8':
ln -= 1 # correction for coding cookie
if not line and fn.startswith("<pyshell#"): if not line and fn.startswith("<pyshell#"):
line = rpchandler.remotecall('linecache', 'getline', line = rpchandler.remotecall('linecache', 'getline',
(fn, ln), {}) (fn, ln), {})
......
...@@ -25,6 +25,12 @@ Library ...@@ -25,6 +25,12 @@ Library
- Issue #24134: Reverted issue #24134 changes. - Issue #24134: Reverted issue #24134 changes.
IDLE
----
- Issue #15809: IDLE shell now uses locale encoding instead of Latin1 for
decoding unicode literals.
What's New in Python 2.7.10 release candidate 1? What's New in Python 2.7.10 release candidate 1?
================================================ ================================================
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment