Message194657
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. |
|
Date |
User |
Action |
Args |
2013-08-08 10:24:38 | kristjan.jonsson | set | recipients:
+ kristjan.jonsson, ncoghlan, r.david.murray, eric.snow |
2013-08-08 10:24:37 | kristjan.jonsson | set | messageid: <1375957477.84.0.220814154739.issue18677@psf.upfronthosting.co.za> |
2013-08-08 10:24:37 | kristjan.jonsson | link | issue18677 messages |
2013-08-08 10:24:37 | kristjan.jonsson | create | |
|