]> granicus.if.org Git - python/commit
#11767: use context manager to close file in __getitem__ to prevent FD leak
authorR David Murray <rdmurray@bitdance.com>
Fri, 17 Jun 2011 16:54:56 +0000 (12:54 -0400)
committerR David Murray <rdmurray@bitdance.com>
Fri, 17 Jun 2011 16:54:56 +0000 (12:54 -0400)
commit05ff9904010a488cc640637ac8255cae41b270dd
tree4dcec34c3a4b2c246bd0b299e96c0e93dae3b9c8
parent26de69dff824a9474ea0044afcbff2d30f109e1e
#11767: use context manager to close file in __getitem__ to prevent FD leak

All of the other methods in mailbox that create message objects take care to
close the file descriptors they use, so it seems to make sense to have
__getitem__ do so as well.

Patch by Filip GruszczyƄski.
Lib/mailbox.py
Lib/test/test_mailbox.py
Misc/NEWS