1.1 --- a/importer.py Sat Feb 04 18:10:20 2017 +0100
1.2 +++ b/importer.py Sat Feb 04 22:26:23 2017 +0100
1.3 @@ -444,6 +444,13 @@
1.4
1.5 if provider and provider != module.name:
1.6
1.7 + # Handle built-in modules accidentally referenced by
1.8 + # names.
1.9 +
1.10 + if provider == "__builtins__" and found.has_kind("<module>"):
1.11 + raise ProgramError("Name %s, used by %s, refers to module %s." %
1.12 + (found.leaf(), module.name, found.get_origin()))
1.13 +
1.14 # Record the provider dependency.
1.15
1.16 module.required.add(provider)