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

login
register
mail settings
Submitter Gregory Szorc
Date March 13, 2017, 4:57 a.m.
Message ID <f3927785d168824ac04c.1489381054@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/19269/
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 1482796473 25200
#      Mon Dec 26 16:54:33 2016 -0700
# Node ID f3927785d168824ac04c4eb44361337775286e01
# Parent  265102f455de6451e493024fb8a9f24d816ce1c2
filemerge: don't use mutable default argument value

Patch

diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -35,8 +35,8 @@  def _toolstr(ui, tool, part, default="")
 def _toolbool(ui, tool, part, default=False):
     return ui.configbool("merge-tools", tool + "." + part, default)
 
-def _toollist(ui, tool, part, default=[]):
-    return ui.configlist("merge-tools", tool + "." + part, default)
+def _toollist(ui, tool, part, default=None):
+    return ui.configlist("merge-tools", tool + "." + part, default or [])
 
 internals = {}
 # Merge tools to document.