templater: remove a mutable default argument
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 24 Sep 2015 01:04:58 -0700
changeset 26330 ec4f3755d997
parent 26329 d9537ce64f3a
child 26331 2c6a741bf05e
templater: remove a mutable default argument Mutable default arguments are know to the state of California to cause bugs.
mercurial/templater.py
--- a/mercurial/templater.py	Thu Sep 24 01:04:10 2015 -0700
+++ b/mercurial/templater.py	Thu Sep 24 01:04:58 2015 -0700
@@ -792,8 +792,10 @@
     filter uses function to transform value. syntax is
     {key|filter1|filter2|...}.'''
 
-    def __init__(self, loader, filters={}, defaults={}):
+    def __init__(self, loader, filters=None, defaults={}):
         self._loader = loader
+        if filters is None:
+            filters = {}
         self._filters = filters
         self._defaults = defaults
         self._cache = {}