Author ncoghlan
Recipients Martin.Teichmann, ncoghlan, serhiy.storchaka
Date 2017-05-10.09:10:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1494407411.18.0.56568967957.issue30306@psf.upfronthosting.co.za>
In-reply-to
Content
Noting something I picked up in the PR review that apparently isn't covered by the test suite: the whole _recreate_cm() dance is necessary to make recursive and concurrent invocation of decorated functions work correctly. Otherwise the original CM instance ends up being shared between different active calls and problems start to arise.

It's these kinds of subtleties that prompted me to declare trying to make otherwise one-shot CMs usable with ContextDecorator an inherently flawed design and hence opt out of making it a public API: https://bugs.python.org/issue11647#msg161113

However, we do still need to keep it working reliably for the @contextmanager case - it's just going to be inherently messy at the implementation level because the original design decision to support the hybrid usage model turned out to be a questionable one.
History
Date User Action Args
2017-05-10 09:10:11ncoghlansetrecipients: + ncoghlan, serhiy.storchaka, Martin.Teichmann
2017-05-10 09:10:11ncoghlansetmessageid: <1494407411.18.0.56568967957.issue30306@psf.upfronthosting.co.za>
2017-05-10 09:10:11ncoghlanlinkissue30306 messages
2017-05-10 09:10:11ncoghlancreate