Ignore:
Timestamp:
Mar 19, 2014, 11:11:30 AM (11 years ago)
Author:
dmik
Message:

python: Update vendor to 2.7.6.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/vendor/current/Lib/filecmp.py

    r2 r388  
    4949        return False
    5050
    51     result = _cache.get((f1, f2))
    52     if result and (s1, s2) == result[:2]:
    53         return result[2]
    54     outcome = _do_cmp(f1, f2)
    55     _cache[f1, f2] = s1, s2, outcome
     51    outcome = _cache.get((f1, f2, s1, s2))
     52    if outcome is None:
     53        outcome = _do_cmp(f1, f2)
     54        if len(_cache) > 100:      # limit the maximum size of the cache
     55            _cache.clear()
     56        _cache[f1, f2, s1, s2] = outcome
    5657    return outcome
    5758
     
    6364def _do_cmp(f1, f2):
    6465    bufsize = BUFSIZE
    65     fp1 = open(f1, 'rb')
    66     fp2 = open(f2, 'rb')
    67     while True:
    68         b1 = fp1.read(bufsize)
    69         b2 = fp2.read(bufsize)
    70         if b1 != b2:
    71             return False
    72         if not b1:
    73             return True
     66    with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2:
     67        while True:
     68            b1 = fp1.read(bufsize)
     69            b2 = fp2.read(bufsize)
     70            if b1 != b2:
     71                return False
     72            if not b1:
     73                return True
    7474
    7575# Directory comparison class.
     
    269269    try:
    270270        return not abs(cmp(a, b, sh))
    271     except os.error:
     271    except (os.error, IOError):
    272272        return 2
    273273
Note: See TracChangeset for help on using the changeset viewer.