4 ms·
Interesting, thanks! I'm afraid I'm having trouble parsing your statement on dev_appserver's behavior. Could you clarify it? It sounds like you're saying that
by davepeck 16y ago
Interesting, thanks!
I'm afraid I'm having trouble parsing your statement on dev_appserver's behavior. Could you clarify it? It sounds like you're saying that dev_appserver both does and doesn't set submodule attributes on parent module instances. Where _should_ NoseGAE be doing this?
As far as I can tell, no code in the App Engine python SDK ever does this. In today's SDK, dev_appserver.py line 2256 adds the submodule to the sys.modules dictionary, but shouldn't there also be a line of code along the lines of setattr(sys.modules[parent_package_name], sub_package_name, submodule)?
Thanks for your help...
- bslatkin 16y agoIIRC (and it's been a few years) the hook goes on sys.meta_path, which uses the HardenedModulesHook to load modules, but then the Python runtime binds the variable names and attributes and whatnot before returning import statements back to application code.
- davepeck 16y agoThe python runtime does not appear to do this in the specific case of submodule attributes. Right now, the Python bug against this indicates that it is considered a documentation bug... but my hunch is that it's an actual bug. I'll try manually inserting the setattr() line into my local copy of the SDK and see how integration testing goes then. What do you use for GAE python integration testing?