# HG changeset patch # User Gregory Szorc # Date 2017-10-02 10:03:53 # Node ID 50474f0b3f1ba42d5a45fd03f420fb7a38fbc05e # Parent 7ed0750c71a12a3cafeaecd90e1f62926ae6b83b changelog: use a Factory for default value for files The default value is compiled into the generated type. This means that default values are shared between instances. For immutable types like bool, str, int, and tuple, this is fine. But for mutable types like list and dict, we need to use attr.Factory() to instantiate a new instance of the default for each object. Differential Revision: https://phab.mercurial-scm.org/D901 diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -151,7 +151,7 @@ class _changelogrevision(object): manifest = attr.ib(default=nullid) user = attr.ib(default='') date = attr.ib(default=(0, 0)) - files = attr.ib(default=[]) + files = attr.ib(default=attr.Factory(list)) description = attr.ib(default='') class changelogrevision(object):