Embedding Python in Python
Darryl
madhobbit at geocities.com
Thu Oct 9 10:39:29 EDT 2003
More information about the Python-list mailing list
Thu Oct 9 10:39:29 EDT 2003
- Previous message (by thread): Is there a JavaMail analog?
- Next message (by thread): Embedding Python in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
JCM <joshway_without_spam at myway.com> wrote in message news:<bm1mt6$maa$1 at fred.mathworks.com>... > (...) What we did was parse the users' code > (take a look at the compiler module) and statically analyze it for > anything "dangerous". Ugh...I had considered this approach but was hoping I didn't have to do it :) I've only been hacking Python for a couple weeks, so I don't know all the ins and outs of what I'd need to watch for...in my experience, most languages seem to have obscure ways of doing things that you wouldn't think of normally, and Python seems no exception. >From a more pragmatic perspective though, this is just a toy project, so it's not too important if I miss something. > (...) anything of the form __ident__ Now that's an interesting idea...from what I've seen of Python, that should catch most of the really obscure ways of doing things. I haven't looked, but I can only assume that Python has regexp matching in it somewhere, so some of the simple checks should be only a few lines of code. A blacklist of keywords seems like a good first start (it's a fairly restrictive context, so even common things like def and lambda can probably be blocked). I also just tested and noticed that syntax errors seem to be thrown as exceptions (rather than causing the interpreter to gasp and die), so I shouldn't have to worry about a badly-written script crashing the whole app. Thanks for the input, - Darryl
- Previous message (by thread): Is there a JavaMail analog?
- Next message (by thread): Embedding Python in Python
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list