Author brett.cannon
Recipients Arfrever, amaury.forgeotdarc, brett.cannon, chris.jerdonek, python-dev, r.david.murray, yselivanov
Date 2012-10-10.13:28:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1349875684.9.0.378961978558.issue15111@psf.upfronthosting.co.za>
In-reply-to
Content
Here are two possible tests.

1) __import__('distutils', fromlist=['_i_do_not_exist']) should return distutils

2) Use a fake loader which executes some code which does nothing more than tries to import a non-existent module. The trick with this test is that the submodule must be found but a module that the submodule needs cannot be found by import itself (and simply not faked with an ImportError thanks to the _not_found hack and needing that attribute to propagate up to the submodule search).

And I think the failure stems from the lack of check against exc.name equaling the name of the module being imported (e.g. exc.name == distutils.msvc9compiler) since the winreg import is a failed module search as well.
History
Date User Action Args
2012-10-10 13:28:04brett.cannonsetrecipients: + brett.cannon, amaury.forgeotdarc, Arfrever, r.david.murray, chris.jerdonek, python-dev, yselivanov
2012-10-10 13:28:04brett.cannonsetmessageid: <1349875684.9.0.378961978558.issue15111@psf.upfronthosting.co.za>
2012-10-10 13:28:04brett.cannonlinkissue15111 messages
2012-10-10 13:28:04brett.cannoncreate