changeset 31445:ac7aa96e4cd8

filemerge: explicitly tests for None Changeset 758526333dec removed the mutable default value, but did not explicitly tested for None. Such implicit testing can introduce semantic and performance issue. We move to an explicit testing for None as recommended by PEP8: https://www.python.org/dev/peps/pep-0008/#programming-recommendations
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 15 Mar 2017 15:11:52 -0700
parents 2daeab02b4b1
children 084050d76e4f
files mercurial/filemerge.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/filemerge.py	Wed Mar 15 15:11:04 2017 -0700
+++ b/mercurial/filemerge.py	Wed Mar 15 15:11:52 2017 -0700
@@ -36,7 +36,9 @@
     return ui.configbool("merge-tools", tool + "." + part, default)
 
 def _toollist(ui, tool, part, default=None):
-    return ui.configlist("merge-tools", tool + "." + part, default or [])
+    if default is None:
+        default = []
+    return ui.configlist("merge-tools", tool + "." + part, default)
 
 internals = {}
 # Merge tools to document.