This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author brett.cannon
Recipients brett.cannon, eric.snow, ethan.furman, kdart, ncoghlan, pitrou, python-dev
Date 2016-04-15.20:09:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1460750951.59.0.0515580015364.issue26186@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2016-04-15 20:09:11brett.cannonsetrecipients: + brett.cannon, ncoghlan, kdart, pitrou, ethan.furman, python-dev, eric.snow
2016-04-15 20:09:11brett.cannonsetmessageid: <1460750951.59.0.0515580015364.issue26186@psf.upfronthosting.co.za>
2016-04-15 20:09:11brett.cannonlinkissue26186 messages
2016-04-15 20:09:11brett.cannoncreate