From c05c73d498f68df6393868766d04f2018951121b Mon Sep 17 00:00:00 2001 From: Pierre-Yves David Date: Wed, 15 Mar 2017 15:10:09 -0700 Subject: [PATCH] hgweb: explicitly tests for None in webutil Changeset 45c7a22dbdc0 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 --- mercurial/hgweb/webutil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py index c0f80709ef..26686e36e3 100644 --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -143,7 +143,9 @@ class filerevnav(revnav): class _siblings(object): def __init__(self, siblings=None, hiderev=None): - self.siblings = [s for s in siblings or [] if s.node() != nullid] + if siblings is None: + siblings = [] + self.siblings = [s for s in siblings if s.node() != nullid] if len(self.siblings) == 1 and self.siblings[0].rev() == hiderev: self.siblings = []