[pypy-commit] pypy default: Call fsdecode_w() also in link() and readlink(), otherwise we can't pass

arigo pypy.commits at gmail.com
Tue Feb 21 07:20:11 EST 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r90256:58d7aea67974
Date: 2017-02-21 12:34 +0100
http://bitbucket.org/pypy/pypy/changeset/58d7aea67974/

Log:	Call fsdecode_w() also in link() and readlink(), otherwise we can't
	pass a unicode containing a non-ascii char

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
@@ -698,9 +698,10 @@
     import signal
     rposix.kill(os.getpid(), signal.SIGABRT)
 
- at unwrap_spec(src='str0', dst='str0')
-def link(space, src, dst):
+def link(space, w_src, w_dst):
     "Create a hard link to a file."
+    src = fsencode_w(space, w_src)
+    dst = fsencode_w(space, w_dst)
     try:
         os.link(src, dst)
     except OSError as e:
@@ -713,9 +714,9 @@
     except OSError as e:
         raise wrap_oserror(space, e)
 
- at unwrap_spec(path='str0')
-def readlink(space, path):
+def readlink(space, w_path):
     "Return a string representing the path to which the symbolic link points."
+    path = fsencode_w(space, w_path)
     try:
         result = os.readlink(path)
     except OSError as e:


More information about the pypy-commit mailing list