[Python-checkins] python/dist/src/Lib inspect.py,1.54,1.55

jlgijsbers at users.sourceforge.net jlgijsbers at users.sourceforge.net
Sat Sep 11 17:53:25 CEST 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2914

Modified Files:
	inspect.py 
Log Message:
Use __module__ attribute when available instead of using isclass() predicate
(functions and methods have grown the __module__ attribute too). See bug #570300.


Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -d -r1.54 -r1.55
--- inspect.py	18 Aug 2004 12:40:30 -0000	1.54
+++ inspect.py	11 Sep 2004 15:53:22 -0000	1.55
@@ -370,7 +370,7 @@
     """Return the module an object was defined in, or None if not found."""
     if ismodule(object):
         return object
-    if isclass(object):
+    if hasattr(object, '__module__'):
         return sys.modules.get(object.__module__)
     try:
         file = getabsfile(object)



More information about the Python-checkins mailing list