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.)
diff --git a/Lib/test/test_tarfile.py b/Lib/test/test_tarfile.py
index ff02c69..94ef61c 100644
--- a/Lib/test/test_tarfile.py
+++ b/Lib/test/test_tarfile.py
@@ -919,6 +919,10 @@
finally:
tar.close()
+ # Verify that filter is a keyword-only argument
+ with self.assertRaises(TypeError):
+ tar.add(tempdir, "empty_dir", True, None, filter)
+
tar = tarfile.open(tmpname, "r")
try:
for tarinfo in tar: