[issue21044] tarfile does not handle file .name being an int
eryksun
report at bugs.python.org
Sat Apr 5 23:01:20 CEST 2014
eryksun added the comment:
> you can't overwrite a io.FileIO().name attribute
A FileIO instance uses a dict for 'name' (msg214670):
>>> vars(sys.stdin.buffer.raw)
{'name': '<stdin>'}
>>> f = tempfile.TemporaryFile()
>>> vars(f.raw)
{'name': 3}
The name is optional meta-information. If it gets deleted, the repr falls back on using the file descriptor:
>>> f.raw
<_io.FileIO name=3 mode='rb+'>
>>> del f.raw.name
>>> f.raw
<_io.FileIO fd=3 mode='rb+'>
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21044>
_______________________________________
More information about the Python-bugs-list
mailing list