Patchwork [6,of,7] localrepo: don't use mutable default argument value

login
register
mail settings
Submitter Pierre-Yves David
Date March 15, 2017, 7:01 a.m.
Message ID <b24451e8f9a6beee5501.1489561278@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/19352/
State Accepted
Headers show

Comments

Pierre-Yves David - March 15, 2017, 7:01 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@ens-lyon.org>
# Date 1489560607 25200
#      Tue Mar 14 23:50:07 2017 -0700
# Node ID b24451e8f9a6beee5501e9bedc47af7edc283ea4
# Parent  855f0045de7f94630923be4639f234b28be89e7f
# EXP-Topic check-pylint
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r b24451e8f9a6
localrepo: don't use mutable default argument value

Caught by pylint.

Patch

diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -119,7 +119,9 @@  legacycaps = moderncaps.union(set(['chan
 class localpeer(peer.peerrepository):
     '''peer for a local repo; reflects only the most recent API'''
 
-    def __init__(self, repo, caps=moderncaps):
+    def __init__(self, repo, caps=None):
+        if caps is None:
+            caps = moderncaps.copy()
         peer.peerrepository.__init__(self)
         self._repo = repo.filtered('served')
         self.ui = repo.ui