bpo-33124: WIP: lazy execution of module bytecode by nascheme · Pull Request #6194 · python/cpython
added 8 commits
February 18, 2018 10:59If <module>.__dict__[<name>] does not exist and <module>.__lazy_code__[<name>] does exist, evaluate the code and then return <module>.<name>. This allows the implementation of lazy module imoprts and lazy module top-level definitions.
This is an alternative to compile_all.py. If the module has __lazy_module__ in the globals (i.e. explicitly marked as lazy safe), top level definitions in the module will become lazy loaded. I.e. the code that is evaluated to create the object will not be evaluated until LOAD_NAME/LOAD_GLOBAL or module getattr() looks for it.
Rather than marking the whole module as lazy safe or not, print a list of top-level module definitions, classifying them as 'lazy' or 'eager'.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters