[Python-Dev] Restricted interpreter

Gustavo Niemeyer niemeyer@conectiva.com
Fri, 8 Nov 2002 19:02:48 -0200

> Are you aware of the standard library module 'rexec'?

In fileobject.c:

/* rexec.py can't stop a user from getting the file() constructor --
   all they have to do is get *any* file object f, and then do
   type(f).  Here we prevent them from doing damage with it. */
if (PyEval_GetRestricted()) {

It looks like I was going to reinvent the wheel. Is this being used in some
project you know about?

Btw, what's the point of FileWrapper, having in mind that it stores
'f' as an accessible attribute?

>>> r.s_exec("""import sys; print sys.stdout.f""")
<open file '<stdout>', mode 'w' at 0x100eec30>

Thank you!

Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]