From f1fcc9a4cb70b96416383a93b0677d5ceb67f603 Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Tue, 23 Oct 2018 15:39:51 +0530 Subject: [PATCH] Remove mutable default value and add a docstring --- mythril/laser/ethereum/state.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/mythril/laser/ethereum/state.py b/mythril/laser/ethereum/state.py index 0b46ba86..edc31194 100644 --- a/mythril/laser/ethereum/state.py +++ b/mythril/laser/ethereum/state.py @@ -130,8 +130,13 @@ class Environment: class Constraints(list): - def __init__(self, constraint_list=[], solver=None, possibility=None): - super(Constraints, self).__init__(constraint_list) + """ + This class should maintain a solver and it's constraints, This class tries to make the Constraints() object + as a simple list of constraints with some background processing. + TODO: add the solver to this class after callback refactor + """ + def __init__(self, constraint_list=None, solver=None, possibility=None): + super(Constraints, self).__init__(constraint_list or []) self.solver = solver self.__possibility = possibility @@ -148,7 +153,7 @@ class Constraints(list): constraint_list = super(Constraints, self).copy() return Constraints(constraint_list) - def __deepcopy__(self, memodict={}): + def __deepcopy__(self, memodict=None): return self.__copy__() def __add__(self, constraints):