[Python-checkins] CVS: python/dist/src/Lib inspect.py,1.4,1.5

Ka-Ping Yee ping@users.sourceforge.net
Thu, 01 Mar 2001 17:19:41 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv991

Modified Files:
	inspect.py 
Log Message:
When seeking the module for an object, compare absolute (not relative) paths.


Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** inspect.py	2001/03/01 13:56:16	1.4
--- inspect.py	2001/03/02 01:19:39	1.5
***************
*** 28,32 ****
  __date__ = '1 Jan 2001'
  
! import sys, types, string, dis, imp, tokenize
  
  # ----------------------------------------------------------- type-checking
--- 28,32 ----
  __date__ = '1 Jan 2001'
  
! import sys, os, types, string, dis, imp, tokenize
  
  # ----------------------------------------------------------- type-checking
***************
*** 200,204 ****
          return sys.modules.get(object.__module__)
      try:
!         file = getsourcefile(object)
      except TypeError:
          return None
--- 200,204 ----
          return sys.modules.get(object.__module__)
      try:
!         file = os.path.abspath(getsourcefile(object))
      except TypeError:
          return None
***************
*** 207,211 ****
      for module in sys.modules.values():
          if hasattr(module, '__file__'):
!             modulesbyfile[getsourcefile(module)] = module.__name__
      if modulesbyfile.has_key(file):
          return sys.modules[modulesbyfile[file]]
--- 207,212 ----
      for module in sys.modules.values():
          if hasattr(module, '__file__'):
!             modulesbyfile[
!                 os.path.abspath(getsourcefile(module))] = module.__name__
      if modulesbyfile.has_key(file):
          return sys.modules[modulesbyfile[file]]