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 michael.foord
Recipients michael.foord, ncoghlan
Date 2010-06-28.22:58:16
SpamBayes Score 0.025473678
Marked as misclassified No
Message-id <1277765898.65.0.314299135702.issue9110@psf.upfronthosting.co.za>
In-reply-to
Content
Patch to add a ContextDecorator class to contextlib. This allows context managers that inherit from ContextDecorator (including using it as a mixin) to be used as decorators as well as context managers.

Context managers inheriting from ContextDecorator still have to implement __enter__ and __exit__ as normal. As the decorator behaviour is implemented using a with statement __exit__ retains its optional exception handling even when used as a decorator.

In addition contextlib.GeneratorContextManager, used to implement contextlib.contextmanager, inherits from ContextDecorator. Context managers created with contextlib.contextmanager can therefore be used as decorators too.
History
Date User Action Args
2010-06-28 22:58:19michael.foordsetrecipients: + michael.foord, ncoghlan
2010-06-28 22:58:18michael.foordsetmessageid: <1277765898.65.0.314299135702.issue9110@psf.upfronthosting.co.za>
2010-06-28 22:58:17michael.foordlinkissue9110 messages
2010-06-28 22:58:16michael.foordcreate