On 28 Sep 2014 15:09, "Brett Cannon"
On Sat Sep 27 2014 at 11:37:16 AM Nathaniel Smith
wrote: On Sat, Sep 27, 2014 at 1:33 AM, Steven D'Aprano
wrote:
Or perhaps these special "modules" could subclass ModuleType and somehow get reloading to work correctly. In 2.7 at least you can manually copy a module to a module subclass, install it into sys.modules, and reload will accept it. Not only that, but after reloading it still uses the same subclass.
Unfortunately, when I tried it in 3.3, imp.reload complained about my custom module subclass not being a module, so it seems that 3.3 at least is more restrictive than 2.7. (Perhaps 3.3 reload does a "type(obj) is ModuleType" instead of isinstance test?)
Yeah, it looks like 3.3 does an explicit 'type(obj) is ModuleType' check, but is the only version that works like this -- earlier and later versions both use isinstance.
Feel free to file an issue about this.
I thought 3.3 is in security-fix only mode? -n