Nick Coghlan added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue30306>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to