[New-bugs-announce] [issue11701] email.parser.BytesParser() uses TextIOWrapper

Steffen Daode Nurpmeso report at bugs.python.org
Mon Mar 28 14:30:20 CEST 2011

New submission from Steffen Daode Nurpmeso <sdaoden at googlemail.com>:

... and that closes the original file, too!
(I've also opened #11700 due to the mailbox.py
side of this.)

static PyObject *
textiowrapper_close(textio *self, PyObject *args)
        return PyObject_CallMethod(self->buffer, "close", NULL);

>>> mb = mailbox.Maildir('sdaoden', create=False)
>>> mbf = mb.get_file(mb.keys()[0])
>>> msg = email.parser.BytesParser().parse(mbf, headersonly=True)
>>> mbf.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/steffen/usr/opt/py3k/lib/python3.3/mailbox.py", line 1922, in close
    if hasattr(self._file, 'close'):
AttributeError: '_ProxyFile' object has no attribute '_file'

components: Library (Lib)
messages: 132397
nosy: r.david.murray, sdaoden
priority: normal
severity: normal
status: open
title: email.parser.BytesParser() uses TextIOWrapper
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list