[issue21044] tempfile.TemporaryFile() shouldn't have a name attribute

eryksun report at bugs.python.org
Mon Mar 24 07:15:32 CET 2014


eryksun added the comment:

This name attribute is documented here:

http://docs.python.org/3/library/io#io.FileIO.name

3.4 Source:

http://hg.python.org/cpython/file/04f714765c13/Modules/_io/fileio.c#l432

In PY2, os.fdopen sets the name to '<fdopen>'. See the related issue 13781. Here's the workaround in gzip.py:

    filename = getattr(fileobj, 'name', '')
    if not isinstance(filename, (str, bytes)):
        filename = ''

----------
nosy: +eryksun

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue21044>
_______________________________________


More information about the Python-bugs-list mailing list