mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
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.)
This commit is contained in:
parent
e3b8f7c0fa
commit
a63a312a3f
4 changed files with 23 additions and 14 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue