[pypy-commit] pypy default: Accept a plain string and don't try to decode it to unicode and then

arigo noreply at buildbot.pypy.org
Sun Aug 31 12:41:08 CEST 2014


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r73222:0867fc01e680
Date: 2014-08-31 12:33 +0200
http://bitbucket.org/pypy/pypy/changeset/0867fc01e680/

Log:	Accept a plain string and don't try to decode it to unicode and then
	re-encode it to utf-8. It may not work.

diff --git a/py/_code/code.py b/py/_code/code.py
--- a/py/_code/code.py
+++ b/py/_code/code.py
@@ -588,7 +588,7 @@
 class TerminalRepr:
     def __str__(self):
         s = self.__unicode__()
-        if sys.version_info[0] < 3:
+        if sys.version_info[0] < 3 and isinstance(s, unicode):
             s = s.encode('utf-8')
         return s
 


More information about the pypy-commit mailing list