Patchwork [4,of,8,V2] hgweb: don't use mutable default argument value

login
register
mail settings
Submitter Gregory Szorc
Date March 13, 2017, 4:57 a.m.
Message ID <14122c7b97163496df5a.1489381056@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/19271/
State Accepted
Headers show

Comments

Gregory Szorc - March 13, 2017, 4:57 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1489380737 25200
#      Sun Mar 12 21:52:17 2017 -0700
# Node ID 14122c7b97163496df5ac6b98f7c2459259673b9
# Parent  735405d42d45801c7b75448e0263088327cac4af
hgweb: don't use mutable default argument value

Patch

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -142,8 +142,8 @@  class filerevnav(revnav):
         return hex(self._changelog.node(self._revlog.linkrev(rev)))
 
 class _siblings(object):
-    def __init__(self, siblings=[], hiderev=None):
-        self.siblings = [s for s in siblings if s.node() != nullid]
+    def __init__(self, siblings=None, hiderev=None):
+        self.siblings = [s for s in siblings or [] if s.node() != nullid]
         if len(self.siblings) == 1 and self.siblings[0].rev() == hiderev:
             self.siblings = []