Message263524
I actually think this can be generalized thanks to some tweaks made in Python 3.6 which will lead to it working with extension modules.
I need to double-check, but I think I can:
- Eliminate the _Module class (and thus have _LazyModule inherit types.ModuleType directly)
- Call create_module() and see if it returns something
- Use spec.loader_state to store the original value of module.__class__ (probably be simply storing __class__ in the dict of values)
- Just blindly try to set module.__class__ to _LazyModule and let the exception propagate if it fails
- In _LazyModule.__getattribute__, temporarily assign the type to types.ModuleType to shut off __getattribute__() before assigning the proper value |
|
Date |
User |
Action |
Args |
2016-04-15 20:09:11 | brett.cannon | set | recipients:
+ brett.cannon, ncoghlan, kdart, pitrou, ethan.furman, python-dev, eric.snow |
2016-04-15 20:09:11 | brett.cannon | set | messageid: <1460750951.59.0.0515580015364.issue26186@psf.upfronthosting.co.za> |
2016-04-15 20:09:11 | brett.cannon | link | issue26186 messages |
2016-04-15 20:09:11 | brett.cannon | create | |
|