This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients benjamin.peterson, pitrou
Date 2011-08-17.22:04:21
SpamBayes Score 1.4194251e-06
Marked as misclassified No
Message-id <1313618661.89.0.946127810392.issue12720@psf.upfronthosting.co.za>
In-reply-to
Content
I think the functions should:
- accept both str and bytes for keys and values; when it's an str, encoding it using the FS encoding
- return str for attribute names, using the FS encoding
- return bytes for attribute values, although returning str might be reasonable as well

I also get the following test failures:

======================================================================
FAIL: test_fds (test.test_os.ExtendedAttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/cpython/default/Lib/test/test_os.py", line 1579, in test_fds
    self._check_xattrs(getxattr, setxattr, removexattr, listxattr)
  File "/home/antoine/cpython/default/Lib/test/test_os.py", line 1542, in _check_xattrs
    setxattr(fn, b"user.test", b"bye", os.XATTR_CREATE)
AssertionError: OSError not raised

======================================================================
FAIL: test_lpath (test.test_os.ExtendedAttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/cpython/default/Lib/test/test_os.py", line 1564, in test_lpath
    os.llistxattr)
  File "/home/antoine/cpython/default/Lib/test/test_os.py", line 1542, in _check_xattrs
    setxattr(fn, b"user.test", b"bye", os.XATTR_CREATE)
AssertionError: OSError not raised

======================================================================
FAIL: test_simple (test.test_os.ExtendedAttributeTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/antoine/cpython/default/Lib/test/test_os.py", line 1560, in test_simple
    os.listxattr)
  File "/home/antoine/cpython/default/Lib/test/test_os.py", line 1542, in _check_xattrs
    setxattr(fn, b"user.test", b"bye", os.XATTR_CREATE)
AssertionError: OSError not raised
History
Date User Action Args
2011-08-17 22:04:21pitrousetrecipients: + pitrou, benjamin.peterson
2011-08-17 22:04:21pitrousetmessageid: <1313618661.89.0.946127810392.issue12720@psf.upfronthosting.co.za>
2011-08-17 22:04:21pitroulinkissue12720 messages
2011-08-17 22:04:21pitroucreate