[Python-Dev] object capability; func_closure; __subclasses__
Phillip J. Eby
pje at telecommunity.com
Thu Jun 28 19:34:05 CEST 2007
At 10:20 AM 6/28/2007 -0700, Robert Brewer wrote:
> > But, all I am asking for is to not expose func_closure (and perhaps
> > some of the other func_*) as members of FunctionType -- isn't it
> > possible to add functionality to the ``new`` module which would allow
> > one to read/write func_closure?
>Would func_closure then also be removed from the FunctionType
>constructor arg list?
That wouldn't be necessary, since restricted code is probably not
going to be allowed access to new in the first place. We're talking
about removing read access to the closure *attribute* only. (And
write access to func_code would also have to be removed, else you
could replace the bytecode in order to grant yourself read access to
the closure contents...)
>If so, would I be expected to create a function
>object and then use the "new" module to supply its func_closure?
Nope. The idea here is that the new module would grow utility
functions like get_closure, get_code, set_code, get_subclasses,
etc. The 'inspect' module would then use these functions to do its
job, and I would use them for generic function stuff.
More information about the Python-Dev