[Python-Dev] Making builtins more efficient (original) (raw)
Jim Jewett jimjjewett at gmail.com
Mon Mar 13 20:47:19 CET 2006
- Previous message: [Python-Dev] decorator module patch
- Next message: [Python-Dev] Making builtins more efficient
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Paul Moore wrote:
Is there any practical way of detecting and flagging constructs like the above (remotely shadowing a builtin in another module)?
Phillip J. Eby wrote:
the patch ended up being backed out ... too strict of a check to be accepted for Python 2.4.
http://svn.python.org/view/python/trunk/Objects/moduleobject.c
It was revision 33054, backed out in 33084.
The patch warned about any shadowing of builtins, which probably is too strict. An alternative might be to warn only about modifying another module's globals. (And perhaps not just when they shadow builtins?)
For example, modules could grow a sealed attribute which gets set at the end of the import; instead of using PyObject_GenericSetAttr directly, the tp_setattro slot would check the sealed attribute (and maybe squawk) before deferring.
-jJ
- Previous message: [Python-Dev] decorator module patch
- Next message: [Python-Dev] Making builtins more efficient
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]