[issue11999] sporadic failure in test_mailbox on FreeBSD

Steffen Daode Nurpmeso report at bugs.python.org
Wed May 4 14:09:27 CEST 2011


Steffen Daode Nurpmeso <sdaoden at googlemail.com> added the comment:

I think this relates #6896.
Maybe a two second resolution should be tried?

----------
keywords: +patch
nosy: +sdaoden
Added file: http://bugs.python.org/file21884/11999.1.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11999>
_______________________________________
-------------- next part --------------
diff --git a/Lib/mailbox.py b/Lib/mailbox.py
--- a/Lib/mailbox.py
+++ b/Lib/mailbox.py
@@ -514,13 +514,11 @@
             else:
                 return
 
-        # We record the current time - 1sec so that, if _refresh() is called
-        # again in the same second, we will always re-read the mailbox
-        # just in case it's been modified.  (os.path.mtime() only has
-        # 1sec resolution.)  This results in a few unnecessary re-reads
-        # when _refresh() is called multiple times in the same second,
-        # but once the clock ticks over, we will only re-read as needed.
-        now = time.time() - 1
+        # Try to be fancy by using a date in the past for our _last_read mtime
+        # checks (see issues #6896, #11999)
+        # Using a two second resolution should be enough to overcome all
+        # fuzziness which may be introduced along the different filesystems.
+        now = time.time() - 2
 
         self._toc = {}
         def update_dir (subdir):


More information about the Python-bugs-list mailing list