changeset 31434:d4645ae6ba15

hgweb: explicitly tests for None in webutil Changeset d2878bec55bd 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:10:09 -0700
parents 7aac35ada1cb
children 2daeab02b4b1
files mercurial/hgweb/webutil.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webutil.py	Wed Mar 15 15:08:45 2017 -0700
+++ b/mercurial/hgweb/webutil.py	Wed Mar 15 15:10:09 2017 -0700
@@ -143,7 +143,9 @@
 
 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 = []