[New-bugs-announce] [issue11700] mailbox.py proxy updates

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

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

I'll send a patch that updates/fixes handling of
file closes in the internal proxy-file classes.
It could cause errors yet because self._file is
del-eted but that field may still be used afterwards.

>>> 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'

The patched version will always act correctly.
And yes, i'll open yet another issue due to the
email.parser (or even TextIOWrapper) based problem.

components: Library (Lib)
messages: 132395
nosy: georg.brandl, r.david.murray, sdaoden, twouters
priority: normal
severity: normal
status: open
title: mailbox.py proxy updates
versions: Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list