Return the xattrs as a list of (attr, value) pairs, or an empty list if extended attributes aren't supported.
(self, *, follow_symlinks=True)
| 379 | |
| 380 | if hasattr(os, 'listxattr'): |
| 381 | def _xattrs(self, *, follow_symlinks=True): |
| 382 | """Return the xattrs as a list of (attr, value) pairs, or an empty |
| 383 | list if extended attributes aren't supported.""" |
| 384 | try: |
| 385 | return [ |
| 386 | (attr, os.getxattr(self._path, attr, follow_symlinks=follow_symlinks)) |
| 387 | for attr in os.listxattr(self._path, follow_symlinks=follow_symlinks)] |
| 388 | except OSError as err: |
| 389 | if err.errno not in (EPERM, ENOTSUP, ENODATA, EINVAL, EACCES): |
| 390 | raise |
| 391 | return [] |
| 392 | |
| 393 | |
| 394 | class _WindowsPathInfo(_PathInfoBase): |