On Wed, Jan 20, 2021 at 9:16 AM Mark Shannon <m...@hotpy.org> wrote:

> I've updated the PEP in light of my experiments and feedback.
> The new API is simpler and a bit more backwards compatible.
>
> https://www.python.org/dev/peps/pep-0651


Minor question: what's the `where` argument to `Py_CheckStackDepth()` for?

The implementation section doesn't mention how you intend to avoid the C
stack for Python-to-Python calls. I have some idea, but it would be nice if
you explained this a bit more. (I'm guessing you are planning to move some
state from local variables into the frame object, store a "return location"
(really frame object + bytecode program counter) somewhere, and then jump
to the top of `_PyEval_EvalFrameDefault()`, or at least somewhere near the
top. Of course this requires adjusting the various `CALL_*` opcodes to
check whether the target is a Python function or not. On `RETURN_VALUE` you
reverse the process, but only if the call came from the previous mechanism.
Do I get a lollipop? :-)

I'm guessing you needn't do anything for generators -- IIRC recursion
through `next()` is not possible, since an active generator cannot be
entered recursively.

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
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/ANYGG5HBC6EU6J4XT7AE74ZNA65IWAPO/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to