diff options
-rw-r--r-- | CHANGES.txt | 4 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | xattr/__init__.py | 6 | ||||
-rw-r--r-- | xattr/tests/test_xattr.py | 10 |
4 files changed, 18 insertions, 4 deletions
diff --git a/CHANGES.txt b/CHANGES.txt index 130ad3c..2b50272 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,7 @@ +Version 0.9.7 released 2019-12-01 + +* Fix xattr().update() in Python 3 + Version 0.9.6 released 2018-07-31 * Fix release build by including *.[ch] in Manifest.in @@ -5,7 +5,7 @@ import sys from setuptools import setup -VERSION = '0.9.6' +VERSION = '0.9.7' DESCRIPTION = "Python wrapper for extended filesystem attributes" LONG_DESCRIPTION = """ Extended attributes extend the basic attributes of files and directories diff --git a/xattr/__init__.py b/xattr/__init__.py index 13389bf..50780b4 100644 --- a/xattr/__init__.py +++ b/xattr/__init__.py @@ -7,7 +7,7 @@ The xattr type wraps a path or file descriptor with a dict-like interface that exposes these extended attributes. """ -__version__ = '0.9.6' +__version__ = '0.9.7' from .compat import integer_types from .lib import (XATTR_NOFOLLOW, XATTR_CREATE, XATTR_REPLACE, @@ -137,9 +137,9 @@ class xattr(object): del self[k] def update(self, seq): - if not hasattr(seq, 'iteritems'): + if not hasattr(seq, 'items'): seq = dict(seq) - for k, v in seq.iteritems(): + for k, v in seq.items(): self[k] = v def copy(self): diff --git a/xattr/tests/test_xattr.py b/xattr/tests/test_xattr.py index cb6ebb9..d2e7533 100644 --- a/xattr/tests/test_xattr.py +++ b/xattr/tests/test_xattr.py @@ -28,6 +28,16 @@ class BaseTestXattr(object): else: self._test_attr() + def test_update(self): + x = xattr.xattr(self.tempfile) + attrs = { + 'user.test.key1': b'test_value1', + 'user.test.key2': b'test_value2' + } + x.update(attrs) + for k, v in attrs.items(): + self.assertEqual(x[k], v) + def _test_attr(self): x = xattr.xattr(self.tempfile) |