@@ -1757,11 +1757,13 @@ def getnames(self):
17571757 return [tarinfo .name for tarinfo in self .getmembers ()]
17581758
17591759 def gettarinfo (self , name = None , arcname = None , fileobj = None ):
1760- """Create a TarInfo object for either the file `name' or the file
1761- object `fileobj' (using os.fstat on its file descriptor). You can
1762- modify some of the TarInfo's attributes before you add it using
1763- addfile(). If given, `arcname' specifies an alternative name for the
1764- file in the archive.
1760+ """Create a TarInfo object from the result of os.stat or equivalent
1761+ on an existing file. The file is either named by `name', or
1762+ specified as a file object `fileobj' with a file descriptor. If
1763+ given, `arcname' specifies an alternative name for the file in the
1764+ archive, otherwise, the name is taken from the 'name' attribute of
1765+ 'fileobj', or the 'name' argument. The name should be a text
1766+ string.
17651767 """
17661768 self ._check ("awx" )
17671769
@@ -1782,7 +1784,7 @@ def gettarinfo(self, name=None, arcname=None, fileobj=None):
17821784 # Now, fill the TarInfo object with
17831785 # information specific for the file.
17841786 tarinfo = self .tarinfo ()
1785- tarinfo .tarfile = self
1787+ tarinfo .tarfile = self # Not needed
17861788
17871789 # Use os.stat or os.lstat, depending on platform
17881790 # and if symlinks shall be resolved.
@@ -1949,10 +1951,9 @@ def add(self, name, arcname=None, recursive=True, exclude=None, *, filter=None):
19491951
19501952 def addfile (self , tarinfo , fileobj = None ):
19511953 """Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
1952- given, tarinfo.size bytes are read from it and added to the archive.
1953- You can create TarInfo objects using gettarinfo().
1954- On Windows platforms, `fileobj' should always be opened with mode
1955- 'rb' to avoid irritation about the file size.
1954+ given, it should be a binary file, and tarinfo.size bytes are read
1955+ from it and added to the archive. You can create TarInfo objects
1956+ directly, or by using gettarinfo().
19561957 """
19571958 self ._check ("awx" )
19581959
0 commit comments