Aight, thanks a lot for your answer!

On Feb 19, 2010 8:38 AM, "Curt Hagenlocher" <[email protected]> wrote:

The short answer is "no, that's not possible".

This is effectively a version of the halting problem (
http://en.wikipedia.org/wiki/Halting_problem). For an arbitrary script, you
can check its syntax for correctness without executing fairly easily. Other
errors are potentially detectable as long as the user refrains from using
certain programming constructs. In your example below, you might be able to
demonstrate that "undefinedVariable" was uninitialized. But the same test
would probably also come to that conclusion in the following code:


a = "This is a test"
exec "undef" + "inedVariables"[:-1] + ' = 10'

print undefinedVariable b = "This is another test"

As for rolling back changes, you could run the script into a temporary scope
if you knew that you were only setting variables. If it succeeds, then run
it into a "real" scope. The problem is that an arbitrary script can have
side effects. Consider the following short script:

import sys
sys.path = []

To protect against that, you effectively need a full sandbox to run code
against.


On Thu, Feb 18, 2010 at 7:16 PM, Alex Turpin <[email protected]> wrote:

> > > Hey all, > > I am currently embedding IronPython in a C# app of mine. I
> need to > execute extern...
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
>


_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to