mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
'inspect' was not listing the functions in a module properly if the module was
reached through a symlink (was comparing path of module to path to function and were not matching because of the symlink). os.path.realpath() is now used to solve this discrepency. Closes bug #570300. Thanks Johannes Gijsbers for the fix.
This commit is contained in:
parent
08d786a608
commit
b3de2e13ba
2 changed files with 7 additions and 1 deletions
|
@ -380,7 +380,9 @@ def getmodule(object):
|
|||
return sys.modules.get(modulesbyfile[file])
|
||||
for module in sys.modules.values():
|
||||
if hasattr(module, '__file__'):
|
||||
modulesbyfile[getabsfile(module)] = module.__name__
|
||||
modulesbyfile[
|
||||
os.path.realpath(
|
||||
getabsfile(module))] = module.__name__
|
||||
if file in modulesbyfile:
|
||||
return sys.modules.get(modulesbyfile[file])
|
||||
main = sys.modules['__main__']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue