Commit 1be10575 authored by David Wilson's avatar David Wilson

importer: Don't respond to non-.py[co] imports.

parent bcae62c6
...@@ -416,7 +416,12 @@ class ModuleFinder(object): ...@@ -416,7 +416,12 @@ class ModuleFinder(object):
if 'six.moves' in fullname: if 'six.moves' in fullname:
# TODO: causes inspect.getsource() to explode. # TODO: causes inspect.getsource() to explode.
return return None, None, None
modpath = getattr(sys.modules[fullname], '__file__', '')
if not modpath.rstrip('co').endswith('.py'):
# Probably a native module.
return None, None, None
is_pkg = hasattr(sys.modules[fullname], '__path__') is_pkg = hasattr(sys.modules[fullname], '__path__')
try: try:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment