Author kristjan.jonsson
Recipients eric.snow, kristjan.jonsson, ncoghlan, r.david.murray
Date 2013-08-08.10:24:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375957477.84.0.220814154739.issue18677@psf.upfronthosting.co.za>
In-reply-to
Content
I've modified the patch.  The problem that nested_delayed was trying to solve are "hybrid" context managers, ones that allocate resources during __init__ and release them at exit.  A proper context manager should allocate resources during __enter__, and thus a number of them can be created upfront with impunity.

Added contextlib.proper to turn a hybrid context manager into a proper one by instantiating the hybrid in a delayed fashion.
added contextlib.opened() as a special case that does open() properly.

With this change, and the ability to nest error handling of exceptions stemming from __enter__(), nested now works as intended.
History
Date User Action Args
2013-08-08 10:24:38kristjan.jonssonsetrecipients: + kristjan.jonsson, ncoghlan, r.david.murray, eric.snow
2013-08-08 10:24:37kristjan.jonssonsetmessageid: <1375957477.84.0.220814154739.issue18677@psf.upfronthosting.co.za>
2013-08-08 10:24:37kristjan.jonssonlinkissue18677 messages
2013-08-08 10:24:37kristjan.jonssoncreate