What I'm trying to do there is this:
 
In the freeze() function, I want to stop executing the current python function, and copy the (python) frame stack, and unroll the python frame stack *and* interpreter level stack frame.
 
In the resume() function, I want to continue executing the python function copied in freeze() function and reconstruct interpreter level stack using resume_state_create() and resume_state_invoke() function.
I think you forgot to answer why are you doing it?

I don't know much about stackless but this seems very similar to what stackless does on pypy (which has stackless at the rpython/interpreter level).
 
 
Except that I'm playing with the main thread stack.
I'm just playing with stackless feature, and I see no reason this should not work...
 
 

--
Leonardo Santagada
santagada at gmail.com