From 192fb78c0a0cbea20fe195bfc01dc164adc84634 Mon Sep 17 00:00:00 2001 From: Kyle Altendorf Date: Mon, 13 Nov 2023 16:39:32 -0500 Subject: [PATCH] avoid use of mutable parameter default for `operators_for_dict()` and `operators_for_module()` (#137) --- clvm/op_utils.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clvm/op_utils.py b/clvm/op_utils.py index 9250b3ac..f91806b3 100644 --- a/clvm/op_utils.py +++ b/clvm/op_utils.py @@ -1,4 +1,7 @@ -def operators_for_dict(keyword_to_atom, op_dict, op_name_lookup={}): +def operators_for_dict(keyword_to_atom, op_dict, op_name_lookup=None): + if op_name_lookup is None: + op_name_lookup = {} + d = {} for op in keyword_to_atom.keys(): op_name = "op_%s" % op_name_lookup.get(op, op) @@ -8,5 +11,7 @@ def operators_for_dict(keyword_to_atom, op_dict, op_name_lookup={}): return d -def operators_for_module(keyword_to_atom, mod, op_name_lookup={}): +def operators_for_module(keyword_to_atom, mod, op_name_lookup=None): + if op_name_lookup is None: + op_name_lookup = {} return operators_for_dict(keyword_to_atom, mod.__dict__, op_name_lookup)