module_has_submodule can report false positives
|Reported by:||Michael Shields||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Python caches failed relative imports using a None in sys.modules. However, module_has_submodule only checks to see whether a key is present in sys.modules, so it can incorrectly report that a module exists when it doesn't.
Attached is a patch (one line, plus a comment) and a regression test.
The patch is against trunk, but the bug also affects 1.2.