Author: Armin Rigo <[email protected]>
Branch: py3k
Changeset: r87354:1706df7088bd
Date: 2016-09-24 09:35 +0200
http://bitbucket.org/pypy/pypy/changeset/1706df7088bd/

Log:    Test and fix: don't give a unicode co_filename from interactive.py

diff --git a/pypy/interpreter/interactive.py b/pypy/interpreter/interactive.py
--- a/pypy/interpreter/interactive.py
+++ b/pypy/interpreter/interactive.py
@@ -169,7 +169,8 @@
 
     def runsource(self, source, ignored_filename="<input>", symbol="single"):
         # the following hacked file name is recognized specially by error.py
-        hacked_filename = '<inline>\n' + source
+        hacked_filename = '<inline>\n' + source.encode(
+                                            'ascii', 'backslashreplace')
         compiler = self.space.getexecutioncontext().compiler
 
         # CPython 2.6 turns console input into unicode
diff --git a/pypy/interpreter/pycode.py b/pypy/interpreter/pycode.py
--- a/pypy/interpreter/pycode.py
+++ b/pypy/interpreter/pycode.py
@@ -106,6 +106,7 @@
         self.co_varnames = varnames
         self.co_freevars = freevars
         self.co_cellvars = cellvars
+        assert isinstance(filename, str)
         rstring.check_str0(filename)
         self.co_filename = filename
         self.co_name = name
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to