[Python-Dev] Accessing globals without dict lookup
Guido van Rossum
Mon, 11 Feb 2002 09:31:32 -0500
> Just a few quick questions before go back into lurcking mode:
Note that I've moved my design to a new PEP, PEP 280. Tim has added
his approach there too. Please read it!!!
> Will it still be possible to:
> a) install new builtins in the __builtin__ namespace and have them
> available in all already loaded modules right away ?
> b) override builtins (e.g. open()) with my own copies
> (e.g. to increase security) in a way that makes these new
> copies override the previous ones in all modules ?
Yes, this is the whole point of this design. In the original
approach, when LOAD_GLOBAL_CELL finds a NULL in the second cell, it
should go back to see if the __builtins__ dict has been modified (the
pseudo code doesn't have this yet). Tim's alternative also takes care
> Also, how does the new scheme get along with the restricted
> execution model ?
> (I have a feeling that this model needs some auditing since so many
> new ways of accessing variables and attributes were introduced since
> the days of 1.5.2)
You may be right.
--Guido van Rossum (home page: http://www.python.org/~guido/)