summaryrefslogtreecommitdiff
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorBrett Cannon <bcannon@gmail.com>2004-08-13 18:46:24 +0000
committerBrett Cannon <bcannon@gmail.com>2004-08-13 18:46:24 +0000
commitb3de2e13baaac7573720c62276984cba13c01c75 (patch)
tree1bdbfc92073f09a00c617d2f9f04705dbf2936ae /Lib/inspect.py
parent08d786a6086a31139edfbb40769dfebed3c9e7c3 (diff)
downloadcpython-git-b3de2e13baaac7573720c62276984cba13c01c75.tar.gz
'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.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 12c9cb757b..7f732649c8 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -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__']