summaryrefslogtreecommitdiffstats
path: root/Lib/tarfile.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
committerGuido van Rossum <guido@python.org>2007-01-10 16:19:56 (GMT)
commitb940e113bf90ff71b0ef57414ea2beea9d2a4bc0 (patch)
tree0b9ea19eba1e665dac95126c3140ac2bc36326ad /Lib/tarfile.py
parent893523e80a2003d4a630aafb84ba016e0070cbbd (diff)
downloadcpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.zip
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.gz
cpython-b940e113bf90ff71b0ef57414ea2beea9d2a4bc0.tar.bz2
SF patch 1631942 by Collin Winter:
(a) "except E, V" -> "except E as V" (b) V is now limited to a simple name (local variable) (c) V is now deleted at the end of the except block
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r--Lib/tarfile.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py
index 3ffdff3..2088e5c 100644
--- a/Lib/tarfile.py
+++ b/Lib/tarfile.py
@@ -1540,7 +1540,7 @@ class TarFile(object):
self.chown(tarinfo, path)
self.utime(tarinfo, path)
self.chmod(tarinfo, path)
- except ExtractError, e:
+ except ExtractError as e:
if self.errorlevel > 1:
raise
else:
@@ -1565,7 +1565,7 @@ class TarFile(object):
try:
self._extract_member(tarinfo, os.path.join(path, tarinfo.name))
- except EnvironmentError, e:
+ except EnvironmentError as e:
if self.errorlevel > 0:
raise
else:
@@ -1573,7 +1573,7 @@ class TarFile(object):
self._dbg(1, "tarfile: %s" % e.strerror)
else:
self._dbg(1, "tarfile: %s %r" % (e.strerror, e.filename))
- except ExtractError, e:
+ except ExtractError as e:
if self.errorlevel > 1:
raise
else:
@@ -1681,7 +1681,7 @@ class TarFile(object):
"""
try:
os.mkdir(targetpath)
- except EnvironmentError, e:
+ except EnvironmentError as e:
if e.errno != errno.EEXIST:
raise
@@ -1745,11 +1745,11 @@ class TarFile(object):
try:
self._extract_member(self.getmember(linkpath), targetpath)
- except (EnvironmentError, KeyError), e:
+ except (EnvironmentError, KeyError) as e:
linkpath = os.path.normpath(linkpath)
try:
shutil.copy2(linkpath, targetpath)
- except EnvironmentError, e:
+ except EnvironmentError as e:
raise IOError("link could not be created")
def chown(self, tarinfo, targetpath):
@@ -1777,7 +1777,7 @@ class TarFile(object):
else:
if sys.platform != "os2emx":
os.chown(targetpath, u, g)
- except EnvironmentError, e:
+ except EnvironmentError as e:
raise ExtractError("could not change owner")
def chmod(self, tarinfo, targetpath):
@@ -1786,7 +1786,7 @@ class TarFile(object):
if hasattr(os, 'chmod'):
try:
os.chmod(targetpath, tarinfo.mode)
- except EnvironmentError, e:
+ except EnvironmentError as e:
raise ExtractError("could not change mode")
def utime(self, tarinfo, targetpath):
@@ -1800,7 +1800,7 @@ class TarFile(object):
return
try:
os.utime(targetpath, (tarinfo.mtime, tarinfo.mtime))
- except EnvironmentError, e:
+ except EnvironmentError as e:
raise ExtractError("could not change modification time")
#--------------------------------------------------------------------------
@@ -1833,7 +1833,7 @@ class TarFile(object):
tarinfo = self.proc_member(tarinfo)
- except HeaderError, e:
+ except HeaderError as e:
if self.ignore_zeros:
self._dbg(2, "0x%X: %s" % (self.offset, e))
self.offset += BLOCKSIZE