changeset 31442:7aac35ada1cb

match: explicitly tests for None Changeset 6168d4b93634 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:08:45 -0700
parents 6e1c79578e5c
children d4645ae6ba15
files mercurial/match.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/match.py	Wed Mar 15 15:05:54 2017 -0700
+++ b/mercurial/match.py	Wed Mar 15 15:08:45 2017 -0700
@@ -117,8 +117,10 @@
                               the same directory
         '<something>' - a pattern of the specified default type
         """
-        include = include or []
-        exclude = exclude or []
+        if include is None:
+            include = []
+        if exclude is None:
+            exclude = []
 
         self._root = root
         self._cwd = cwd