diff options
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-x | Lib/tarfile.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 9e291c2a584..4b4e0d35e14 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1842,14 +1842,17 @@ class TarFile(object): tarinfo.devminor = os.minor(statres.st_rdev) return tarinfo - def list(self, verbose=True): + def list(self, verbose=True, *, members=None): """Print a table of contents to sys.stdout. If `verbose' is False, only the names of the members are printed. If it is True, an `ls -l'-like - output is produced. + output is produced. `members' is optional and must be a subset of the + list returned by getmembers(). """ self._check() - for tarinfo in self: + if members is None: + members = self + for tarinfo in members: if verbose: _safe_print(stat.filemode(tarinfo.mode)) _safe_print("%s/%s" % (tarinfo.uname or tarinfo.uid, |