diff options
author | Guido van Rossum <guido@python.org> | 2006-08-24 04:03:53 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2006-08-24 04:03:53 (GMT) |
commit | 8f78fe9a10c24706b04d07be9149d84aa6016db7 (patch) | |
tree | 19baf80fe80bc845a71f892597e46f61e1b792de /Lib/tarfile.py | |
parent | b053cd8f40dd19985b16f50661640dcefb69888f (diff) | |
download | cpython-8f78fe9a10c24706b04d07be9149d84aa6016db7.zip cpython-8f78fe9a10c24706b04d07be9149d84aa6016db7.tar.gz cpython-8f78fe9a10c24706b04d07be9149d84aa6016db7.tar.bz2 |
Fix fallout from Anna's file -> open changes.
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r-- | Lib/tarfile.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index f7ddac8..d238063 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -65,6 +65,8 @@ except ImportError: # from tarfile import * __all__ = ["TarFile", "TarInfo", "is_tarfile", "TarError"] +from __builtin__ import open as _open # Since 'open' is TarFile.open + #--------------------------------------------------------- # tar constants #--------------------------------------------------------- @@ -934,7 +936,7 @@ class TarFile(object): self.mode = {"r": "rb", "a": "r+b", "w": "wb"}[mode] if not fileobj: - fileobj = open(self.name, self.mode) + fileobj = _open(self.name, self.mode) self._extfileobj = False else: if self.name is None and hasattr(fileobj, "name"): @@ -1083,7 +1085,7 @@ class TarFile(object): tarname = pre + ext if fileobj is None: - fileobj = open(name, mode + "b") + fileobj = _open(name, mode + "b") if mode != "r": name = tarname @@ -1355,7 +1357,7 @@ class TarFile(object): # Append the tar header and data to the archive. if tarinfo.isreg(): - f = open(name, "rb") + f = _open(name, "rb") self.addfile(tarinfo, f) f.close() @@ -1617,7 +1619,7 @@ class TarFile(object): """Make a file called targetpath. """ source = self.extractfile(tarinfo) - target = open(targetpath, "wb") + target = _open(targetpath, "wb") copyfileobj(source, target) source.close() target.close() |