IOError is a synonym for OSError, so the latter should be used
everywhere to avoid confusion, especially when throwing the one
but catching the other.
Cf. PEP 3151.
if self.cmp is not None:
try:
buf = self.cmp.decompress(buf)
- except IOError:
+ except OSError:
raise ReadError("invalid compressed data")
except Exception as e:
# happens at the end of the file
iterate = False
try:
copyfileobj(source, target, tarinfo.size)
- except IOError: # on *any* IOError even in the target?
+ except OSError:
source.close()
# only if we are extracting a multivolume this can be treated
if not self.new_volume_handler:
try:
tarobj.fileobj.close()
tarobj.open_volume(volume_path)
- except IOError as e:
+ except OSError as e:
# only volume number 2 is missing
assert volume_number == 2
raise e
new_volume_handler=new_volume_handler2)
try:
tarobj.extractall()
- except IOError as e:
+ except OSError as e:
pass
tarobj.close()
assert os.path.exists("big")