diff options
author | R David Murray <rdmurray@bitdance.com> | 2014-02-02 16:11:01 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2014-02-02 16:11:01 (GMT) |
commit | 4885f49e7fcef35ad25c50f4c6876c56e2a9f545 (patch) | |
tree | fe1b3367a3a5585596a2cd72f7e4df7eefe78138 | |
parent | 70e04f5fbc0b62c4d1d04fd982204437120f791d (diff) | |
download | cpython-4885f49e7fcef35ad25c50f4c6876c56e2a9f545.zip cpython-4885f49e7fcef35ad25c50f4c6876c56e2a9f545.tar.gz cpython-4885f49e7fcef35ad25c50f4c6876c56e2a9f545.tar.bz2 |
whatsnew: filecmp.clear_cache, and reword description of cache in docs.
-rw-r--r-- | Doc/library/filecmp.rst | 8 | ||||
-rw-r--r-- | Doc/whatsnew/3.4.rst | 11 | ||||
-rw-r--r-- | Lib/filecmp.py | 4 |
3 files changed, 17 insertions, 6 deletions
diff --git a/Doc/library/filecmp.rst b/Doc/library/filecmp.rst index 8471a72..06d3f21 100644 --- a/Doc/library/filecmp.rst +++ b/Doc/library/filecmp.rst @@ -28,8 +28,8 @@ The :mod:`filecmp` module defines the following functions: portability and efficiency. This function uses a cache for past comparisons and the results, - with a cache invalidation mechanism relying on stale signatures - or by explicitly calling :func:`clear_cache`. + with cache entries invalidated if the :func:`os.stat` information for the + file changes. The entire cache may be cleared using :func:`clear_cache`. .. function:: cmpfiles(dir1, dir2, common, shallow=True) @@ -54,12 +54,12 @@ The :mod:`filecmp` module defines the following functions: .. function:: clear_cache() - .. versionadded:: 3.4 - Clear the filecmp cache. This may be useful if a file is compared so quickly after it is modified that it is within the mtime resolution of the underlying filesystem. + .. versionadded:: 3.4 + .. _dircmp-objects: diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst index 2292297..4417f74 100644 --- a/Doc/whatsnew/3.4.rst +++ b/Doc/whatsnew/3.4.rst @@ -675,6 +675,17 @@ handling). (Contributed by R. David Murray in :issue:`18891`.) +filecmp +------- + +A new :func:`~filecmp.clear_cache` function provides the ability to clear the +:mod:`filecmp` comparison cache, which uses :func:`os.stat` information to +determine if the file has changed since the last compare. This can be used, +for example, if the file might have been changed and re-checked in less time +than the resolution of a particular filesystem's file modification time field. +(Contributed by Mark Levitt in :issue:`18149`.) + + functools --------- diff --git a/Lib/filecmp.py b/Lib/filecmp.py index 3285288..dd5a2af 100644 --- a/Lib/filecmp.py +++ b/Lib/filecmp.py @@ -43,8 +43,8 @@ def cmp(f1, f2, shallow=True): True if the files are the same, False otherwise. This function uses a cache for past comparisons and the results, - with a cache invalidation mechanism relying on stale signatures - or by explicitly calling clear_cache(). + with cache entries invalidated if their stat information + changes. The cache may be cleared by calling clear_cache(). """ |