summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorKa-Ping Yee <ping@zesty.ca>2001-04-12 13:37:39 (GMT)
committerKa-Ping Yee <ping@zesty.ca>2001-04-12 13:37:39 (GMT)
commit131216290b76b4dd858d951b2ae8ed848bf3e7b1 (patch)
tree4fb667a580fdf7d00b09b4617ec17aa1603d6b3b /Lib/pydoc.py
parentb910efe8a948acc7a39d91ca7cfff96f0968a580 (diff)
downloadcpython-131216290b76b4dd858d951b2ae8ed848bf3e7b1.zip
cpython-131216290b76b4dd858d951b2ae8ed848bf3e7b1.tar.gz
cpython-131216290b76b4dd858d951b2ae8ed848bf3e7b1.tar.bz2
Give up trying to keep dynamically loaded extensions up to date:
the import.c machinery has soundly defeated my every attempt.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index cc0f27b..4a21bc3 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1017,7 +1017,13 @@ def freshimport(path, cache={}):
# isn't good enough (e.g. what if the module contains a class that
# inherits from another module that has changed?).
if path not in sys.builtin_module_names:
- del sys.modules[path]
+ # Python never loads a dynamic extension a second time from the
+ # same path, even if the file is changed or missing. Deleting
+ # the entry in sys.modules doesn't help for dynamic extensions,
+ # so we're not even going to try to keep them up to date.
+ info = inspect.getmoduleinfo(sys.modules[path].__file__)
+ if info[3] != imp.C_EXTENSION:
+ del sys.modules[path]
try:
module = __import__(path)
except: