changeset 26326:58218b0e6005

match: remove a mutable default argument Mutable default arguments are know to the state of California to cause bugs.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 24 Sep 2015 01:00:05 -0700
parents cce8ebd31407
children c786dd6cae57
files mercurial/scmutil.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Thu Sep 24 00:59:26 2015 -0700
+++ b/mercurial/scmutil.py	Thu Sep 24 01:00:05 2015 -0700
@@ -753,13 +753,15 @@
         ret.append(kindpat)
     return ret
 
-def matchandpats(ctx, pats=(), opts={}, globbed=False, default='relpath',
+def matchandpats(ctx, pats=(), opts=None, globbed=False, default='relpath',
                  badfn=None):
     '''Return a matcher and the patterns that were used.
     The matcher will warn about bad matches, unless an alternate badfn callback
     is provided.'''
     if pats == ("",):
         pats = []
+    if opts is None:
+        opts = {}
     if not globbed and default == 'relpath':
         pats = expandpats(pats or [])