Author: Carl Friedrich Bolz <[email protected]>
Branch: 
Changeset: r80486:7b5e71e6e62f
Date: 2015-10-30 10:27 +0100
http://bitbucket.org/pypy/pypy/changeset/7b5e71e6e62f/

Log:    more encoding problems

diff --git a/pypy/module/_file/interp_file.py b/pypy/module/_file/interp_file.py
--- a/pypy/module/_file/interp_file.py
+++ b/pypy/module/_file/interp_file.py
@@ -302,9 +302,13 @@
             data = space.getarg_w('s*', w_data).as_str()
         else:
             if space.isinstance_w(w_data, space.w_unicode):
+                w_errors = w_encoding = None
+                if self.encoding:
+                    w_encoding = space.wrap(self.encoding)
+                if self.errors:
+                    w_errors = space.wrap(self.errors)
                 w_data = space.call_method(w_data, "encode",
-                                           space.wrap(self.encoding),
-                                           space.wrap(self.errors))
+                                           w_encoding, w_errors)
             data = space.charbuf_w(w_data)
         self.do_direct_write(data)
 
diff --git a/pypy/module/posix/interp_posix.py 
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -459,9 +459,9 @@
 else:
     def getcwdu(space):
         """Return the current working directory as a unicode string."""
-        filesystemencoding = space.sys.filesystemencoding
+        w_filesystemencoding = getfilesystemencoding(space)
         return space.call_method(getcwd(space), 'decode',
-                                 space.wrap(filesystemencoding))
+                                 w_filesystemencoding)
 
 def chdir(space, w_path):
     """Change the current working directory to the specified path."""
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to