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

Re: [pygame] pygame web plugin



On Sun, Sep 7, 2008 at 12:49 PM, Campbell Barton <ideasman42@xxxxxxxxx> wrote:
> Im still a bit at a loss as to where the blocking problem is...
>
> if I was to sandbox cpython for a pygame heres what Id try.
>
> - replace builtins like import, compile, exec, reload  through the C
> api (as with the blender3d example I posted earlier, scripters will
> need to write scripts accounting for this perhaps in one py file to
> start with.
> - try to replace pythons memory allocator with one that can be
> limited.. OR, patch python to limit the memory it can use. (web plugin
> could statically link the patched python) OR use process some OS
> control to limit memory management.
>
> What else would you need to do to sandbox python for a web plugin?

Just give up and figure out how to compile Python to JavaScript or
ActionScript or some other well tested VM designed for this kind of
use case. Then you won't even need to get people to install a plug-in,
because everyone already has JavaScript in their browser and almost
everyone has Flash (except on iPhone).

PyPy -> Flash VM sounded like a promising approach, and it provides
everything that pygame does (and then some) on a technical level
anyway, so it'd largely be an exercise in writing a wrapper library to
expose a familiar API.

-bob