[Tutor] Embedded Python question

D-Man dsh8290@rit.edu
Wed, 13 Jun 2001 19:04:31 -0400


On Wed, Jun 13, 2001 at 10:42:10PM +0000, Alan Gauld wrote:
| This comes from the Czech translators of my tutor.
| I only use Python for prototyping so have no experience 
| of embedding. However I seem to recall some folks asking 
| here so...
| 
| >an advice regarding running more than 1 Python embedded interpreter at the
| >same time? Or could you please give us any impulse where we can find out it?
| >In the concrete: we need run the Py_RunSimpleString() method
| >from various C++ threads at the same time.
| 
| ie, They want to know can they run multiple interpreters (or 
| more accurately call the function) from multiple threads 
| within a single process? Is Python threadsafe at that level? 
| I have no idea, does anyone else?

I haven't done any embedding, but from what I understand the issue is
mainly that the Python stack is intertwined with the C stack.
Stackless Python would probably be safer for this because it stores
the Python stack separately on the C heap, so as long as it can switch
between different Python stacks, it can have different interpreters
(probably even allowing for shared globals, etc).

-D