summaryrefslogtreecommitdiff
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorJohannes Gijsbers <jlg@dds.nl>2004-09-11 15:53:22 +0000
committerJohannes Gijsbers <jlg@dds.nl>2004-09-11 15:53:22 +0000
commit9324526a7658c5450eba24b48065d87d5db5ab1f (patch)
tree432c6fd0d5296e47b0a239694a11e2f38c9a990b /Lib/inspect.py
parentc9c37ca62e1aa6bda1fca5882048645bb6b11fba (diff)
downloadcpython-git-9324526a7658c5450eba24b48065d87d5db5ab1f.tar.gz
Use __module__ attribute when available instead of using isclass() predicate
(functions and methods have grown the __module__ attribute too). See bug #570300.
Diffstat (limited to 'Lib/inspect.py')
-rw-r--r--Lib/inspect.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index 3c47cd9b44..5e3f7e2c90 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -370,7 +370,7 @@ def getmodule(object):
"""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)