mirror of
https://github.com/python/cpython.git
synced 2025-07-30 14:44:10 +00:00
#1288615: Python code.interact() and non-ASCII input
This commit is contained in:
parent
b2793a4766
commit
74022ab013
1 changed files with 4 additions and 0 deletions
|
@ -232,6 +232,10 @@ class InteractiveConsole(InteractiveInterpreter):
|
|||
prompt = sys.ps1
|
||||
try:
|
||||
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:
|
||||
self.write("\n")
|
||||
break
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue