diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-16 20:58:58 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2014-07-16 20:58:58 (GMT) |
commit | 2c6a3aedeb47ce763454f936545b6dddabbe29cb (patch) | |
tree | 85c8b05cf6ef10c7dfd6057d8968190f1c993ec5 /Lib/tarfile.py | |
parent | 8faecbfb425747130061e89eb619cb6dcdfa1c49 (diff) | |
download | cpython-2c6a3aedeb47ce763454f936545b6dddabbe29cb.zip cpython-2c6a3aedeb47ce763454f936545b6dddabbe29cb.tar.gz cpython-2c6a3aedeb47ce763454f936545b6dddabbe29cb.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 |