[issue11647] function decorated with a context manager can only be invoked once

Nick Coghlan report at bugs.python.org
Sat May 19 14:52:04 CEST 2012


Nick Coghlan <ncoghlan at gmail.com> added the comment:

I'm closing this *without* converting ContextDecorator._recreate_cm() to a public method (although I'm also attaching the patch that would have done exactly that).

My rationale for doing so is that I *still* consider making _GeneratorContextManager a subclass of ContextDecorator a design error on my part. Converting the existing _recreate_cm() hook to a public refesh_cm() method would be actively endorsing that mistake and encouraging others to repeat it.

If anyone else wants to pursue this, create a new issue and be prepared to be very persuasive. After all, the current module maintainer just rejected his own implementation of the feature :)

----------
resolution:  -> fixed
status: open -> closed
Added file: http://bugs.python.org/file25638/issue11647_refresh_cm.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11647>
_______________________________________


More information about the Python-bugs-list mailing list