[pypy-commit] pypy py3.6: must build the strings at import

mattip pypy.commits at gmail.com
Tue Sep 17 08:05:22 EDT 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.6
Changeset: r97514:023a3e349a63
Date: 2019-09-17 15:04 +0300
http://bitbucket.org/pypy/pypy/changeset/023a3e349a63/

Log:	must build the strings at import

diff --git a/pypy/module/sys/interp_encoding.py b/pypy/module/sys/interp_encoding.py
--- a/pypy/module/sys/interp_encoding.py
+++ b/pypy/module/sys/interp_encoding.py
@@ -9,16 +9,20 @@
 
 if sys.platform == "win32":
     base_encoding = "mbcs"
+    base_error = "strict"
 elif sys.platform == "darwin":
     base_encoding = "utf-8"
+    base_error = "surrogateescape"
 elif sys.platform == "linux2":
     base_encoding = "ascii"
+    base_error = "surrogateescape"
 else:
     # In CPython, the default base encoding is NULL. This is paired with a
     # comment that says "If non-NULL, this is different than the default
     # encoding for strings". Therefore, the default filesystem encoding is the
     # default encoding for strings, which is ASCII.
     base_encoding = "ascii"
+    base_error = "surrogateescape"
 
 def _getfilesystemencoding(space):
     encoding = base_encoding
@@ -51,6 +55,4 @@
 
 
 def getfilesystemencodeerrors(space):
-    if sys.platform == "win32":
-        return space.newtext('strict')
-    return space.newtext('surrogateescape')
+    return space.newtext(base_error)


More information about the pypy-commit mailing list