diff --git a/mercurial/archival.py b/mercurial/archival.py --- a/mercurial/archival.py +++ b/mercurial/archival.py @@ -163,16 +163,7 @@ class tarit: mtime=mtime, ) self.fileobj = gzfileobj - return ( - # taropen() wants Literal['a', 'r', 'w', 'x'] for the mode, - # but Literal[] is only available in 3.8+ without the - # typing_extensions backport. - # pytype: disable=wrong-arg-types - tarfile.TarFile.taropen( # pytype: disable=attribute-error - name, pycompat.sysstr(mode), gzfileobj - ) - # pytype: enable=wrong-arg-types - ) + return tarfile.TarFile.taropen(name, "w", gzfileobj) else: try: return tarfile.open(