summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorKa-Ping Yee <ping@zesty.ca>2001-03-01 13:56:16 (GMT)
committerKa-Ping Yee <ping@zesty.ca>2001-03-01 13:56:16 (GMT)
commit8b58b84d729a80a06f1bfe9ebfbbfd67de7445ef (patch)
tree2c03884ff7a35de7722b064710df4591a5215abf /Lib
parent66efbc74811f153a02728942adbbfc549bf10398 (diff)
downloadcpython-8b58b84d729a80a06f1bfe9ebfbbfd67de7445ef.zip
cpython-8b58b84d729a80a06f1bfe9ebfbbfd67de7445ef.tar.gz
cpython-8b58b84d729a80a06f1bfe9ebfbbfd67de7445ef.tar.bz2
Add __author__ variable.
Robustify: don't rely on modules being present in sys.modules.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/inspect.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/inspect.py b/Lib/inspect.py
index f6e70ed..240ff1d 100644
--- a/Lib/inspect.py
+++ b/Lib/inspect.py
@@ -24,7 +24,8 @@ Here are some of the useful functions provided by this module:
# This module is in the public domain. No warranties.
-__version__ = 'Ka-Ping Yee <ping@lfw.org>, 1 Jan 2001'
+__author__ = 'Ka-Ping Yee <ping@lfw.org>'
+__date__ = '1 Jan 2001'
import sys, types, string, dis, imp, tokenize
@@ -196,7 +197,7 @@ modulesbyfile = {}
def getmodule(object):
"""Try to guess which module an object was defined in."""
if isclass(object):
- return sys.modules[object.__module__]
+ return sys.modules.get(object.__module__)
try:
file = getsourcefile(object)
except TypeError:
@@ -630,3 +631,5 @@ def stack(context=1):
def trace(context=1):
"""Return a list of records for the stack below the current exception."""
return getinnerframes(sys.exc_traceback, context)
+
+