> > I think it's worse that this though, as it seems that in gen_send_ex()
> > it actually pushes a value onto the stack. That can't be solved by
> > simply adding a state attribute to the generator object struct.
>
> At the higher level, "it doesn't push value on stack", it "sets value
> of the yield operator to return".

Potatoes, potahtoes. :-) The current implementation "sets the value of
the yield operator to return" by pushing a value onto the stack:

        /* Push arg onto the frame's value stack */
        result = arg ? arg : Py_None;
        Py_INCREF(result);
        *(f->f_stacktop++) = result;

Thanks for the replies. I will cook up some private API in my cpython
fork. Whether or not my new vm ever sees the light of day, I think it
would be worthwhile to consider a proper API (even a _PyEval macro or
two) for the little dance the two subsystems do.

Skip
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/NR66U3TD3BH6K7CQTA4B6HOLOT3KP3VF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to