summaryrefslogtreecommitdiffstats
path: root/Lib/inspect.py
diff options
context:
space:
mode:
authorJohannes Gijsbers <jlg@dds.nl>2004-09-11 15:53:22 (GMT)
committerJohannes Gijsbers <jlg@dds.nl>2004-09-11 15:53:22 (GMT)
commit9324526a7658c5450eba24b48065d87d5db5ab1f (patch)
tree432c6fd0d5296e47b0a239694a11e2f38c9a990b /Lib/inspect.py
parentc9c37ca62e1aa6bda1fca5882048645bb6b11fba (diff)
downloadcpython-9324526a7658c5450eba24b48065d87d5db5ab1f.zip
cpython-9324526a7658c5450eba24b48065d87d5db5ab1f.tar.gz
cpython-9324526a7658c5450eba24b48065d87d5db5ab1f.tar.bz2
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 3c47cd9..5e3f7e2 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)