[pypy-commit] pypy py3.5: listxattr returns a list of str, not of bytes

rlamy pypy.commits at gmail.com
Wed Dec 20 08:35:58 EST 2017


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: py3.5
Changeset: r93515:def83ef09f31
Date: 2017-12-20 13:35 +0000
http://bitbucket.org/pypy/pypy/changeset/def83ef09f31/

Log:	listxattr returns a list of str, not of bytes

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
@@ -2389,7 +2389,8 @@
             result = rposix.listxattr(path.as_bytes, follow_symlinks)
         except OSError as e:
             raise wrap_oserror(space, e, eintr_retry=False)
-    return space.newlist([space.newbytes(attr) for attr in result])
+    return space.newlist([
+        space.fsdecode(space.newbytes(attr)) for attr in result])
 
 
 have_functions = []
diff --git a/pypy/module/posix/test/test_posix2.py b/pypy/module/posix/test/test_posix2.py
--- a/pypy/module/posix/test/test_posix2.py
+++ b/pypy/module/posix/test/test_posix2.py
@@ -1451,10 +1451,10 @@
             raises(OSError, os.getxattr, self.path, 'user.test')
             os.setxattr(self.path, 'user.test', b'', os.XATTR_CREATE, follow_symlinks=False)
             assert os.getxattr(self.path, 'user.test') == b''
-            os.setxattr(self.path, 'user.test', b'foo', os.XATTR_REPLACE)
+            os.setxattr(self.path, b'user.test', b'foo', os.XATTR_REPLACE)
             assert os.getxattr(self.path, 'user.test', follow_symlinks=False) == b'foo'
             assert set(os.listxattr(self.path)) == set(
-                init_names + [b'user.test'])
+                init_names + ['user.test'])
             os.removexattr(self.path, 'user.test', follow_symlinks=False)
             raises(OSError, os.getxattr, self.path, 'user.test')
             assert os.listxattr(self.path, follow_symlinks=False) == init_names


More information about the pypy-commit mailing list