[PATCH] config: avoid using a mutable default
Martijn Pieters
mj at zopatista.com
Sun Mar 12 19:56:20 UTC 2017
# HG changeset patch
# User Martijn Pieters <mjpieters at fb.com>
# Date 1489348572 25200
# Sun Mar 12 12:56:12 2017 -0700
# Node ID 22c38e571b5ccf3bb6d9f075526170954843f37a
# Parent 719e64bf9ec2d7b8e86b6550a5d193b3c67944d1
config: avoid using a mutable default
Nothing *currently* mutates this list, but the moment something does it'll be
shared between all config instances. Avoid this eventuality.
diff --git a/mercurial/config.py b/mercurial/config.py
--- a/mercurial/config.py
+++ b/mercurial/config.py
@@ -18,11 +18,11 @@
)
class config(object):
- def __init__(self, data=None, includepaths=[]):
+ def __init__(self, data=None, includepaths=None):
self._data = {}
self._source = {}
self._unset = []
- self._includepaths = includepaths
+ self._includepaths = includepaths or []
if data:
for k in data._data:
self._data[k] = data[k].copy()
More information about the Mercurial-devel
mailing list