This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author midnightdf
Recipients midnightdf
Date 2010-02-16.17:43:47
SpamBayes Score 3.2264746e-12
Marked as misclassified No
Message-id <1266342231.42.0.692171370087.issue7944@psf.upfronthosting.co.za>
In-reply-to
Content
Sprinkled throughout CPython's test modules are snippets of code such as the following taken from 2.7A3's test_old_mailbox.py (line 141):
    box = mailbox.UnixMailbox(open(self._path, 'r'))

The key thing to observe here is the file being opened yet never has it's 'close' method explicitly called.  While this is fine for CPython's rather predictable garbage collections, it's quite possible that in alternate implementations of Python this file object won't be destroyed until well after line 141.  This can result in seemingly random failures of CPython's tests under alternate implementations of Python.

The solution to this problem would be to consistently use the 'with' statement (or alternatively close all open file objects) throughout all CPython test modules.

I've gone ahead and submitted an updated (2.7A3) version of test_old_mailbox.py which addresses this.  We can find other places where this is going on as well, but for the most part the tests already seem to be doing the right thing.
History
Date User Action Args
2010-02-16 17:43:51midnightdfsetrecipients: + midnightdf
2010-02-16 17:43:51midnightdfsetmessageid: <1266342231.42.0.692171370087.issue7944@psf.upfronthosting.co.za>
2010-02-16 17:43:49midnightdflinkissue7944 messages
2010-02-16 17:43:49midnightdfcreate