[IronPython] Is it possible to set a maximum loop size for scripts?

Alex News anleewxs at gmail.com
Sat Apr 18 14:36:29 CEST 2009

In the general case this isn't possible:

Perhaps some sort of timeout logic would work for you?  I.e. kill the
script if it is still running after some predetermined amount of time.
 I do not know if IronPython has any such functionality built in, but
it should be easy enough to roll your own.

On 4/18/09, theoobe <omgomgomg at f2s.com> wrote:
>  I have a C# application with IronPython scripting.  I wonder, is it possible
>  to prevent users from creating infinite loops in their scripts?
>  So for example, if a script is executed which contains a loop, and loop is
>  infinate, would it be possible for my C# application to detect this, perhaps
>  by having a maximum loop cycle count?  Thus preventing my application from
>  hanging...
>  I've tried googling around on this subject but I've had no joy.  Maybe what
>  I'm asking for isn't possible?
>  Thanks alot!
> --
>  View this message in context: http://www.nabble.com/Is-it-possible-to-set-a-maximum-loop-size-for-scripts--tp23084739p23084739.html
>  Sent from the IronPython mailing list archive at Nabble.com.
>  _______________________________________________
>  Users mailing list
>  Users at lists.ironpython.com
>  http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

More information about the Ironpython-users mailing list