summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2011-01-26 20:34:14 (GMT)
committerRaymond Hettinger <python@rcn.com>2011-01-26 20:34:14 (GMT)
commita63a312a3f5a4f3b76617831e56ac9d295929fa0 (patch)
tree18504231f06733d800b5417cd6e0c4c0de6e8966 /Lib/tarfile.py
parente3b8f7c0fa47bbf7c31a2912789e1618e129b539 (diff)
downloadcpython-a63a312a3f5a4f3b76617831e56ac9d295929fa0.zip
cpython-a63a312a3f5a4f3b76617831e56ac9d295929fa0.tar.gz
cpython-a63a312a3f5a4f3b76617831e56ac9d295929fa0.tar.bz2
Issue #11014: Make 'filter' argument in tarfile.Tarfile.add() into a
keyword-only argument. The preceding positional argument was deprecated, so it made no sense to add filter as a positional argument. (Patch reviewed by Brian Curtin and Anthony Long.)
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r--Lib/tarfile.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index fd898c7..e3747e9 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -2025,7 +2025,7 @@ class TarFile(object):
print("link to", tarinfo.linkname, end=' ')
print()
- def add(self, name, arcname=None, recursive=True, exclude=None, filter=None):
+ def add(self, name, arcname=None, recursive=True, exclude=None, *, filter=None):
"""Add the file `name' to the archive. `name' may be any type of file
(directory, fifo, symbolic link, etc.). If given, `arcname'
specifies an alternative name for the file in the archive.
@@ -2082,7 +2082,7 @@ class TarFile(object):
if recursive:
for f in os.listdir(name):
self.add(os.path.join(name, f), os.path.join(arcname, f),
- recursive, exclude, filter)
+ recursive, exclude, filter=filter)
else:
self.addfile(tarinfo)