changeset 26334:0a5a774f5956

templater: remove a mutable default argument Mutable default arguments are know to the state of California to cause bugs.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Thu, 24 Sep 2015 01:07:09 -0700
parents 727d57e94cda
children 6c93834d7d66
files mercurial/templater.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/templater.py	Thu Sep 24 01:06:41 2015 -0700
+++ b/mercurial/templater.py	Thu Sep 24 01:07:09 2015 -0700
@@ -833,7 +833,7 @@
 
 class templater(object):
 
-    def __init__(self, mapfile, filters=None, defaults=None, cache={},
+    def __init__(self, mapfile, filters=None, defaults=None, cache=None,
                  minchunk=1024, maxchunk=65536):
         '''set up template engine.
         mapfile is name of file to read map definitions from.
@@ -843,6 +843,8 @@
             filters = {}
         if defaults is None:
             defaults = {}
+        if cache is None:
+            cache = {}
         self.mapfile = mapfile or 'template'
         self.cache = cache.copy()
         self.map = {}