[Python-Dev] Adding a builtins parameter to eval(), exec() and import(). (original) (raw)

Brett Cannon brett at python.org
Wed Mar 7 20:16:02 CET 2012


On Wed, Mar 7, 2012 at 10:56, Benjamin Peterson <benjamin at python.org> wrote:

2012/3/7 Mark Shannon <mark at hotpy.org>: > Currently, it is impossible to allow one function access to sensitive > functions like open(), while denying it to others, as any code can then > get the builtins of another function via f.globals['builtins']._ > Separating builtins from globals could solve this.

I like this idea. We could finally kill builtins, too, which has often been confusing for people.

I like it as well. It's a mess right now to try to grab the import() implementation and this would actually help clarify import semantics by saying that import() for any chained imports comes from import()s locals, globals, or builtins arguments (in that order) or from the builtins module itself (i.e. tstate->builtins). -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20120307/3d47246c/attachment.html>



More information about the Python-Dev mailing list