Author michael.foord
Recipients michael.foord, ncoghlan
Date 2010-06-28.22:58:16
SpamBayes Score 0.0254737
Marked as misclassified No
Message-id <>
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.
Date User Action Args
2010-06-28 22:58:19michael.foordsetrecipients: + michael.foord, ncoghlan
2010-06-28 22:58:18michael.foordsetmessageid: <>
2010-06-28 22:58:17michael.foordlinkissue9110 messages
2010-06-28 22:58:16michael.foordcreate