summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2004-08-20 06:35:46 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2004-08-20 06:35:46 (GMT)
commit61d77e0d970fb816efa1d0bc758c4b461da99e8c (patch)
tree2865176e647ef66fd1ead3e4c5394b1ad5d3030b /Lib/tarfile.py
parent701abe745b28024662886c254a4dbc2ee1dddb3a (diff)
downloadcpython-61d77e0d970fb816efa1d0bc758c4b461da99e8c.zip
cpython-61d77e0d970fb816efa1d0bc758c4b461da99e8c.tar.gz
cpython-61d77e0d970fb816efa1d0bc758c4b461da99e8c.tar.bz2
Replace tricky and/or with straight-forward if:else:
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r--Lib/tarfile.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index ba5a1d2..ff9f51f 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -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