ysj.ray <ysj....@gmail.com> added the comment: Here I worked out a patch to make the function decorated by context manager returned by @contextmanager reusable, by storing original function object and argments(args, kwds objects) in _GeneratorContextManager and construct a generator when needed(in self.__enter__ while used as a context manager and self.__call__ while used as a decorator). It still inherit ContextDecorator to keep class inheritation complete and the __call__ method is override.
---------- keywords: +patch Added file: http://bugs.python.org/file21449/issue_11647.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue11647> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com