18.02.20 11:28, M.-A. Lemburg пише:
This sounds like a nice idea, but it may make sense to limit the frame to one already on the stack. Otherwise, the code you're executing may never return to your current stack...
I do not think there will be such problem. exec() will temporary replace the stack of frames before executing the code and restore the original stack after it be finished. Since the stack is implemented as a single-linked list, and multiple lists can share the same tail, it all should be zero-overhead.
OTOH, perhaps that could be regarded and used as a feature, similar to what PyPy exposes:
Thank you for the link. It is interesting. The difference with PyPy is that I do not propose to create cycles. And since CPython uses the single C stack it has nothing with stackless and do not allow to get rid of the recursion depth limit. But there is something common in these ideas -- both work with f_back. Maybe more.