Embedding Python the extreme way

Alex Martelli aleax at aleax.it
Wed Jul 10 09:48:47 EDT 2002


Wolfgang Draxinger wrote:
        ...
>> For getting rid of builtin functions, why bother?
> 
> Because some of them can mess up all. I know what I'm talking about.
> I should have said, getting rid of all where it is possible and
> replacing the rest with custom stuff at a low level base.

What you choose to expose to client scripts as "builtins" is
entirely under your control.  This is exactly what the rexec
module is all about -- controlling what builtins, names from 
sys, names from os, and built-in modules, are made available
to untrusted scripts.  Subclass rexec.RExec appropriately and
use an instance of your class to build the "sandbox" in which
the untrusted scripts execute -- building the sandbox includes
possibly populating it with your supplementary or replacement
builtins etc, of course.


Alex




More information about the Python-list mailing list