Embedding Python in Python

JCM joshway_without_spam at myway.com
Wed Aug 18 16:25:04 EDT 2004


Jack Diederich <jack at performancedrivers.com> wrote:
> On Wed, Aug 18, 2004 at 07:44:47PM +0000, JCM wrote:
...
>> I don't think it's as difficult as you think.  Your snippet of code
>> would be rejected by the rules I suggested.  You'd also want to
>> prohibit other builtins like compile, execfile, input, reload, vars,
>> etc.
>> 
> foo = "ev" + "al"
> e = vars()['__builtins__'].__dict__[foo]
> print e('2+2')

Also would be rejected by my original set of rules (can't use
__dict__).  But I'd disallow vars too.



More information about the Python-list mailing list