[IronPython] Don't execute files containing errors?
alex.turpin at gmail.com
Fri Feb 19 14:54:30 CET 2010
Aight, thanks a lot for your answer!
On Feb 19, 2010 8:38 AM, "Curt Hagenlocher" <curt at hagenlocher.org> 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:
sys.path = 
To protect against that, you effectively need a full sandbox to run code
On Thu, Feb 18, 2010 at 7:16 PM, Alex Turpin <alex.turpin at gmail.com> wrote:
> > > Hey all, > > I am currently embedding IronPython in a C# app of mine. I
> need to > execute extern...
> Users mailing list
> Users at lists.ironpython.com
Users mailing list
Users at lists.ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ironpython-users