mirror of
https://github.com/python/cpython.git
synced 2025-07-15 07:15:18 +00:00
Replace tricky and/or with straight-forward if:else:
This commit is contained in:
parent
701abe745b
commit
61d77e0d97
1 changed files with 5 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue