changeset 45589:3d5b2b8e93fd

changing-files: move default constructor value to None According to Augie Fackler, using tuple as default value confuse PyType when actual values are passed at init time. Differential Revision: https://phab.mercurial-scm.org/D9086
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 24 Sep 2020 09:32:07 +0200
parents c35db907363d
children 11f3c3f408fd
files mercurial/metadata.py
diffstat 1 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/metadata.py	Mon Sep 28 11:16:12 2020 +0200
+++ b/mercurial/metadata.py	Thu Sep 24 09:32:07 2020 +0200
@@ -40,15 +40,20 @@
     """
 
     def __init__(
-        self, touched=(), added=(), removed=(), p1_copies=(), p2_copies=(),
+        self,
+        touched=None,
+        added=None,
+        removed=None,
+        p1_copies=None,
+        p2_copies=None,
     ):
-        self._added = set(added)
-        self._removed = set(removed)
-        self._touched = set(touched)
+        self._added = set(() if added is None else added)
+        self._removed = set(() if removed is None else removed)
+        self._touched = set(() if touched is None else touched)
         self._touched.update(self._added)
         self._touched.update(self._removed)
-        self._p1_copies = dict(p1_copies)
-        self._p2_copies = dict(p2_copies)
+        self._p1_copies = dict(() if p1_copies is None else p1_copies)
+        self._p2_copies = dict(() if p2_copies is None else p2_copies)
 
     def __eq__(self, other):
         return (