[Python-checkins] CVS: python/nondist/sandbox/help inspect.py,1.2,1.3

Ka-Ping Yee python-dev@python.org
Sun, 14 Jan 2001 03:58:20 -0800


Update of /cvsroot/python/python/nondist/sandbox/help
In directory usw-pr-cvs1:/tmp/cvs-serv20592

Modified Files:
	inspect.py 
Log Message:
Fix getmodule() to look at __module__ on classes.


Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/help/inspect.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** inspect.py	2001/01/14 11:16:11	1.2
--- inspect.py	2001/01/14 11:58:17	1.3
***************
*** 188,191 ****
--- 188,193 ----
  def getmodule(object):
      """Try to guess which module an object was defined in."""
+     if isclass(object):
+         return sys.modules[object.__module__]
      try:
          file = getsourcefile(object)