[Python-checkins] cpython (3.2): Issue #12603: Fix pydoc.synopsis() on files with non-negative st_mtime.

charles-francois.natali python-checkins at python.org
Wed Jul 27 19:39:47 CEST 2011


http://hg.python.org/cpython/rev/2bc740a83010
changeset:   71534:2bc740a83010
branch:      3.2
parent:      71527:c3aebd01a033
user:        Charles-François Natali <neologix at free.fr>
date:        Wed Jul 27 19:40:02 2011 +0200
summary:
  Issue #12603: Fix pydoc.synopsis() on files with non-negative st_mtime.

files:
  Lib/pydoc.py |  4 ++--
  Misc/NEWS    |  2 ++
  2 files changed, 4 insertions(+), 2 deletions(-)


diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -224,8 +224,8 @@
 def synopsis(filename, cache={}):
     """Get the one-line summary out of a module file."""
     mtime = os.stat(filename).st_mtime
-    lastupdate, result = cache.get(filename, (0, None))
-    if lastupdate < mtime:
+    lastupdate, result = cache.get(filename, (None, None))
+    if lastupdate is None or lastupdate < mtime:
         info = inspect.getmoduleinfo(filename)
         try:
             file = tokenize.open(filename)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -37,6 +37,8 @@
 Library
 -------
 
+- Issue #12603: Fix pydoc.synopsis() on files with non-negative st_mtime.
+
 - Issue #12607: In subprocess, fix issue where if stdin, stdout or stderr is
   given as a low fd, it gets overwritten.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list