# HG changeset patch # User Mads Kiilerich # Date 2019-10-13 00:05:19 # Node ID 8864aa96f1f6d279ff2e57f29e0b139d709a0f1b # Parent 6ceb3721e2035aeaffdaa1941b20ddabc6a688ce localrepo: fix variable binding in handling of old filters The lambda was referencing oldfn in outer scope without binding the current value. If oldfn function were reassigned before use, wrong filters could be used. Fixed by having oldfn as named parameter default value of the lambda. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1907,7 +1907,7 @@ class localrepository(object): # Wrap old filters not supporting keyword arguments if not pycompat.getargspec(fn)[2]: oldfn = fn - fn = lambda s, c, **kwargs: oldfn(s, c) + fn = lambda s, c, oldfn=oldfn, **kwargs: oldfn(s, c) fn.__name__ = 'compat-' + oldfn.__name__ l.append((mf, fn, params)) self._filterpats[filter] = l