Kaydet (Commit) 74022ab0 authored tarafından Antoine Pitrou's avatar Antoine Pitrou

#1288615: Python code.interact() and non-ASCII input

üst b2793a47
...@@ -232,6 +232,10 @@ class InteractiveConsole(InteractiveInterpreter): ...@@ -232,6 +232,10 @@ class InteractiveConsole(InteractiveInterpreter):
prompt = sys.ps1 prompt = sys.ps1
try: try:
line = self.raw_input(prompt) line = self.raw_input(prompt)
# Can be None if sys.stdin was redefined
encoding = getattr(sys.stdin, "encoding", None)
if encoding and not isinstance(line, unicode):
line = line.decode(encoding)
except EOFError: except EOFError:
self.write("\n") self.write("\n")
break break
......
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