[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Scripting language



On 12/19/06, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
Richard Tew wrote:
>> while True:
>>   pass
>>
>> def fib(n):
>>   return fib(n-1) + fib(n-2)
>> fib(1000000)
>
> If you were using Stackless Python, this sort of thing could
> easily be detected, interrupted and discarded.

But what about things like

x = 100000000000000000000000 ** 1000000000000000000000000

No :) Stackless' "run for so many Python instructions" mode would not be able to do anything about that. But if you were satisfied with whatever trivial level of Python the recipe could allow, then I imagine this would be something you could use that to guard against.

> I wonder if this recipe were taken to the safe extreme, how
> much of a subset of Python could be safely allowed:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/286134

Probably not feasible to relax it enough to allow
non-trivial code without opening up unwanted abilities.

Perhaps. It would be an interesting project for someone to take up though in order to see how far it can be taken safely.

Richard.