diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2008-08-07 18:42:40 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2008-08-07 18:42:40 (GMT) |
commit | 74022ab0130c84ca3bbe567dccffaf4cd4cb0452 (patch) | |
tree | acba67f3ab672da922118c4e97680b6cf58afe9e | |
parent | b2793a4766d64a147c66eed833c69584bf96e6d0 (diff) | |
download | cpython-74022ab0130c84ca3bbe567dccffaf4cd4cb0452.zip cpython-74022ab0130c84ca3bbe567dccffaf4cd4cb0452.tar.gz cpython-74022ab0130c84ca3bbe567dccffaf4cd4cb0452.tar.bz2 |
#1288615: Python code.interact() and non-ASCII input
-rw-r--r-- | Lib/code.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/code.py b/Lib/code.py index 6bdc658..2e3ee11 100644 --- a/Lib/code.py +++ b/Lib/code.py @@ -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 |