diff options
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-x | Lib/tarfile.py | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index ba3e95f..bb09d10 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1787,10 +1787,9 @@ class TarFile(object): tarinfo = self.tarinfo() tarinfo.tarfile = self # Not needed - # Use os.stat or os.lstat, depending on platform - # and if symlinks shall be resolved. + # Use os.stat or os.lstat, depending on if symlinks shall be resolved. if fileobj is None: - if hasattr(os, "lstat") and not self.dereference: + if not self.dereference: statres = os.lstat(name) else: statres = os.stat(name) @@ -2235,11 +2234,10 @@ class TarFile(object): def chmod(self, tarinfo, targetpath): """Set file permissions of targetpath according to tarinfo. """ - if hasattr(os, 'chmod'): - try: - os.chmod(targetpath, tarinfo.mode) - except OSError: - raise ExtractError("could not change mode") + try: + os.chmod(targetpath, tarinfo.mode) + except OSError: + raise ExtractError("could not change mode") def utime(self, tarinfo, targetpath): """Set modification time of targetpath according to tarinfo. |