diff options
author | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-06-04 21:31:20 (GMT) |
---|---|---|
committer | Nadeem Vawda <nadeem.vawda@gmail.com> | 2012-06-04 21:31:20 (GMT) |
commit | aebcdba8297bf5174ecf4e8687ad23883e35b14b (patch) | |
tree | b9b55d8bb72a27f439da47f98d676f56876d8237 /Lib/tarfile.py | |
parent | 68721019efb16ba8acad036c331a9a195d6f7da0 (diff) | |
download | cpython-aebcdba8297bf5174ecf4e8687ad23883e35b14b.zip cpython-aebcdba8297bf5174ecf4e8687ad23883e35b14b.tar.gz cpython-aebcdba8297bf5174ecf4e8687ad23883e35b14b.tar.bz2 |
Make BZ2File's fileobj support easier to use.
The fileobj argument was added during the 3.3 development cycle, so this change
does not break backward compatibility with 3.2.
Diffstat (limited to 'Lib/tarfile.py')
-rw-r--r-- | Lib/tarfile.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 8549677..6d73569 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1657,8 +1657,8 @@ class TarFile(object): except ImportError: raise CompressionError("bz2 module is not available") - fileobj = bz2.BZ2File(filename=name if fileobj is None else None, - mode=mode, fileobj=fileobj, compresslevel=compresslevel) + fileobj = bz2.BZ2File(fileobj or name, mode, + compresslevel=compresslevel) try: t = cls.taropen(name, mode, fileobj, **kwargs) |