diff options
| -rw-r--r-- | sphinx/util/__init__.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 6cb83aec..7dce7012 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -197,14 +197,14 @@ def get_module_source(modname): except Exception, err: raise PycodeError('error importing %r' % modname, err) mod = sys.modules[modname] - if hasattr(mod, '__loader__'): - try: - source = mod.__loader__.get_source(modname) - except Exception, err: - raise PycodeError('error getting source for %r' % modname, err) - return 'string', source filename = getattr(mod, '__file__', None) if filename is None: + if hasattr(mod, '__loader__'): + try: + source = mod.__loader__.get_source(modname) + except Exception, err: + raise PycodeError('error getting source for %r' % modname, err) + return 'string', source raise PycodeError('no source found for module %r' % modname) filename = path.normpath(path.abspath(filename)) lfilename = filename.lower() |
