[pypy-commit] pypy default: Merge change bf651562fa0c from pyrepl:
arigo
noreply at buildbot.pypy.org
Sat Oct 27 09:38:03 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r58488:43d0a2bd9ab1
Date: 2012-10-27 09:37 +0200
http://bitbucket.org/pypy/pypy/changeset/43d0a2bd9ab1/
Log: Merge change bf651562fa0c from pyrepl:
- When the history file contains non-utf8 character sequences, don't
crash but just replace them with the "unknown" unicode char.
- When writing out text to the terminal, use "?" instead of crashing
when the text cannot be encoded.
diff --git a/lib_pypy/pyrepl/readline.py b/lib_pypy/pyrepl/readline.py
--- a/lib_pypy/pyrepl/readline.py
+++ b/lib_pypy/pyrepl/readline.py
@@ -233,7 +233,7 @@
try:
return unicode(line, ENCODING)
except UnicodeDecodeError: # bah, silently fall back...
- return unicode(line, 'utf-8')
+ return unicode(line, 'utf-8', 'replace')
def get_history_length(self):
return self.saved_history_length
diff --git a/lib_pypy/pyrepl/unix_console.py b/lib_pypy/pyrepl/unix_console.py
--- a/lib_pypy/pyrepl/unix_console.py
+++ b/lib_pypy/pyrepl/unix_console.py
@@ -496,7 +496,7 @@
if iscode:
self.__tputs(text)
else:
- os.write(self.output_fd, text.encode(self.encoding))
+ os.write(self.output_fd, text.encode(self.encoding, 'replace'))
del self.__buffer[:]
def __tputs(self, fmt, prog=delayprog):
More information about the pypy-commit
mailing list