Replacing open builtin
Jp Calderone
exarkun at divmod.com
Wed May 11 08:29:33 EDT 2005
On 11 May 2005 05:20:28 -0700, rmm at iname.com wrote:
>If I replace the open builtin eg
>
>import main
>__main__.__builtins__.open=None
>
>Is there any way, from here on, to access the original open function??
>
>Extending this slightly, lets say I put a reference to the original
>open function inside a class called Isolate and protect this reference
>using __getattribute__ and __setattr__. Is the original function now
>isolated and only able to be referenced within Isolate.
>
>In summary, are there any references to builtin functions others than
>through __builtins__ and is __getattribute__, __setattr__ secure
Only about a zillion. For example:
>>> type(sys.stdout)('/dev/null')
<open file '/dev/null', mode 'r' at 0xb7df53c8>
Jp
More information about the Python-list
mailing list