From 47a2bcf6e844292c7754cf9bd726a5416e5ad24a Mon Sep 17 00:00:00 2001 From: Enji Cooper Date: Fri, 27 Mar 2020 17:24:53 -0700 Subject: [PATCH] Don't accumulate arguments in `Entry.GetTranslation` Initialize `extradict` safely to avoid accumulating arguments in dict objects passed in across calls. Signed-off-by: Enji Cooper --- event_rpcgen.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/event_rpcgen.py b/event_rpcgen.py index 590b4eb4..8e9ed1fc 100755 --- a/event_rpcgen.py +++ b/event_rpcgen.py @@ -484,7 +484,9 @@ class Entry: "around line %d" % (self._name, self.LineCount()) ) - def GetTranslation(self, extradict={}): + def GetTranslation(self, extradict=None): + if extradict is None: + extradict = {} mapping = { "parent_name": self._struct.Name(), "name": self._name, -- 2.40.0