On 14 June 2017 at 13:02, Mahmoud Hashemi <mahm...@hatnote.com> wrote: > That would be amazing! If there's anything I can do to help make that > happen, please let me know. It'll almost certainly save that much time for > me alone down the line, anyway :)
The `IMPORT_FROM` opcode's error handling would probably be the best place to start poking around: https://github.com/python/cpython/blob/master/Python/ceval.c#L5055 If you can prove the concept there, that would: 1. Directly handle the "from x import y" and "import x.y as name" cases 2. Provide a starting point for factoring out a "report missing module attribute" helper that could be shared with ModuleType As an example of querying _frozen_importlib state from C code, I'd point to https://github.com/python/cpython/blob/master/Python/import.c#L478 Cheers, Nick. P.S. I also double checked that ImportError & AttributeError have compatible binary layouts, so dual inheritance from them works :) -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/