]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Replace tricky and/or with straight-forward if:else:
authorMartin v. Löwis <martin@v.loewis.de>
Fri, 20 Aug 2004 06:35:46 +0000 (06:35 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Fri, 20 Aug 2004 06:35:46 +0000 (06:35 +0000)
Lib/tarfile.py

index ba5a1d21f6fec0b9be0f1a0adaba26f741046428..ff9f51f2651f67871e183b17aaa09cff975c39a0 100644 (file)
@@ -1137,7 +1137,11 @@ class TarFile(object):
         tarinfo.mode  = stmd
         tarinfo.uid   = statres.st_uid
         tarinfo.gid   = statres.st_gid
-        tarinfo.size  = not stat.S_ISDIR(stmd) and statres.st_size or 0
+        if stat.S_ISDIR(stmd):
+            # For a directory, the size must be 0
+            tarinfo.size  = 0
+        else:
+            tarinfo.size = statres.st_size
         tarinfo.mtime = statres.st_mtime
         tarinfo.type  = type
         tarinfo.linkname = linkname