[pypy-svn] r63892 - pypy/trunk/pypy/interpreter

afa at codespeak.net afa at codespeak.net
Thu Apr 9 15:13:02 CEST 2009


Author: afa
Date: Thu Apr  9 15:13:01 2009
New Revision: 63892

Modified:
   pypy/trunk/pypy/interpreter/interactive.py
Log:
code.InteractiveConsole in CPython 2.6 returns unicode strings.
Re-encode the input source, this fixes py.py on top of python 2.6.


Modified: pypy/trunk/pypy/interpreter/interactive.py
==============================================================================
--- pypy/trunk/pypy/interpreter/interactive.py	(original)
+++ pypy/trunk/pypy/interpreter/interactive.py	Thu Apr  9 15:13:01 2009
@@ -169,7 +169,11 @@
         # the following hacked file name is recognized specially by error.py
         hacked_filename = '<inline>\n' + source
         compiler = self.space.getexecutioncontext().compiler
-        
+
+        # CPython 2.6 turns console input into unicode
+        if isinstance(source, unicode):
+            source = source.encode(sys.stdin.encoding)
+
         def doit():
             # compile the provided input
             code = compiler.compile_command(source, hacked_filename, symbol,



More information about the Pypy-commit mailing list