On Thu, Nov 27, 2014 at 9:53 AM, Nick Coghlan <ncogh...@gmail.com> wrote:
> The implicit stop decorator would then check the flags on the code object
> attached to the passed in function. If GENERATOR wasn't set, that would be
> an immediate ValueError, while if EXPLICIT_STOP wasn't set, the generator
> function would be passed through unmodified. However, if EXPLICIT_STOP *was*
> set, the generator function would be replaced by a *new* generator function
> with a *new* code object, where the only change was to clear the
> EXPLICIT_STOP flag.

Is it possible to replace the code object without replacing the
function? Imagine if you have multiple decorators, one of which
retains a reference to the function and then this one which replaces
it - the order of decoration would be critical. OTOH, I don't know
that anyone would retain references to __code__.

ChrisA
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to