[pypy-dev] Calling PyPy interpreter from C?

Leonardo Santagada santagada at gmail.com
Wed Jun 3 19:49:09 CEST 2009


On Jun 3, 2009, at 2:16 PM, Bryan Buck wrote:

> Hi,
>
> I have a question about PyPy - I hope this mailing list is the right
> place for it, let me know if not.
>
> Is there any way to link PyPy's Python interpreter with a C program  
> and
> call it from C? I'm interested in embedding the interpreter in another
> program as its scripting engine. (The reason I'm looking at PyPy  
> instead
> of CPython is that I'd like to use the sandboxing feature.)


I think that specially because of the sandbox you don't want to link  
the interpreter with your c program. The whole idea of the sandbox is  
to comunicate with the intepreter only thru a controlling program that  
uses stdin/stdout to control the pypy interpreter in a subprocess.

Take a look at the sandboxing page:
http://codespeak.net/pypy/dist/pypy/doc/sandbox.html

see:

''we can translate PyPy to a special "pypy-c-sandbox" executable,  
which is safe in the sense that it doesn't do any library or system  
calls - instead, whenever it would like to perform such an operation,  
it marshals the operation name and the arguments to its stdout and it  
waits for the marshalled result on its stdin. This pypy-c-sandbox  
process is meant to be run by an outer "controller" program that  
answers these operation requests.''

--
Leonardo Santagada
santagada at gmail.com






More information about the Pypy-dev mailing list