If I understand your problem, you have a C ++ program that calls in python. When python finishes executing the function, you want to pause the interpreter and choose where the C ++ code stopped. Some time later, your C ++ program should return to python, and the python interpreter will pick up where it left off.
, . , :
[ top of stack ]
[ some interpreter frames ]
[ some c++ frames ]
, ++. , , , . (. http://en.wikipedia.org/wiki/Setjmp.h), . API .
. , ++ ( 1), ++ 2 python.
( ++) 1, 2 (, , . https://computing.llnl.gov/tutorials/pthreads/). 1, . 2 ( ) 1 . , 2 ( 2, 1 ). . , .