Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r92221:b4d19ffb3525
Date: 2017-08-23 15:39 +0200
http://bitbucket.org/pypy/pypy/changeset/b4d19ffb3525/

Log:    Issue #2638

        Workaround for .python_history files that have non-utf-8 chars.

        But ideally we should encode/decode the content in some locale-aware
        format, instead of using UTF-8 all the time.

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
@@ -314,7 +314,8 @@
         # history item: we use \r\n instead of just \n.  If the history
         # file is passed to GNU readline, the extra \r are just ignored.
         history = self.get_reader().history
-        f = open(os.path.expanduser(filename), 'r', encoding='utf-8')
+        f = open(os.path.expanduser(filename), 'r', encoding='utf-8',
+                 errors='replace')
         buffer = []
         for line in f:
             if line.endswith('\r\n'):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to