Author: Ronan Lamy <[email protected]>
Branch: py3.5
Changeset: r93589:70dfe4f14f67
Date: 2017-12-28 16:56 +0100
http://bitbucket.org/pypy/pypy/changeset/70dfe4f14f67/
Log: Fix: the 'flags' argument to setxattr() had no effect
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
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit