diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-16 21:00:26 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-16 21:00:26 (GMT) |
commit | a98faefd68da474d5155979f5f9174f98bb6227b (patch) | |
tree | 8e5ea7a584f4073f1eb1eb858b749d410a6183c4 /Lib/tarfile.py | |
parent | 05d7d156266ac561e988ed84d6fbaf044541d855 (diff) | |
parent | 2c6a3aedeb47ce763454f936545b6dddabbe29cb (diff) | |
download | cpython-a98faefd68da474d5155979f5f9174f98bb6227b.zip cpython-a98faefd68da474d5155979f5f9174f98bb6227b.tar.gz cpython-a98faefd68da474d5155979f5f9174f98bb6227b.tar.bz2 |
Issue 21044: tarfile.open() now handles fileobj with an integer 'name'
attribute. Based on patch by Martin Panter.
Diffstat (limited to 'Lib/tarfile.py')
-rwxr-xr-x | Lib/tarfile.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 0a90257..9e291c2 100755 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -1423,7 +1423,8 @@ class TarFile(object): fileobj = bltn_open(name, self._mode) self._extfileobj = False else: - if name is None and hasattr(fileobj, "name"): + if (name is None and hasattr(fileobj, "name") and + isinstance(fileobj.name, (str, bytes))): name = fileobj.name if hasattr(fileobj, "mode"): self._mode = fileobj.mode |