Author: Ronan Lamy <ronan.l...@gmail.com>
Branch: release-pypy3.5-v5.9.x
Changeset: r93594:f05e6bdccc8d
Date: 2017-12-28 16:56 +0100
http://bitbucket.org/pypy/pypy/changeset/f05e6bdccc8d/

Log:    Fix: the 'flags' argument to setxattr() had no effect (grafted from
        70dfe4f14f678cefb5bdc58ed4ac4b354c30cf8b)

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
@@ -2331,12 +2331,12 @@
             raise oefmt(space.w_ValueError,
                 "setxattr: cannot use fd and follow_symlinks together")
         try:
-            rposix.fsetxattr(path.as_fd, attribute.as_bytes, value)
+            rposix.fsetxattr(path.as_fd, attribute.as_bytes, value, flags)
         except OSError as e:
             raise wrap_oserror(space, e, path.as_bytes)
     else:
         try:
-            rposix.setxattr(path.as_bytes, attribute.as_bytes, value,
+            rposix.setxattr(path.as_bytes, attribute.as_bytes, value, flags,
                 follow_symlinks=follow_symlinks)
         except OSError as e:
             raise wrap_oserror(space, e, path.as_bytes)
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
@@ -1455,6 +1455,8 @@
             excinfo = raises(OSError, os.getxattr, self.path, 'user.test')
             assert excinfo.value.filename == self.path
             os.setxattr(self.path, 'user.test', b'', os.XATTR_CREATE, 
follow_symlinks=False)
+            raises(OSError,
+                os.setxattr, self.path, 'user.test', b'', os.XATTR_CREATE)
             assert os.getxattr(self.path, 'user.test') == b''
             os.setxattr(self.path, b'user.test', b'foo', os.XATTR_REPLACE)
             assert os.getxattr(self.path, 'user.test', follow_symlinks=False) 
== b'foo'
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to