Skip to content

Commit

Permalink
Remove one action in Element setstate
Browse files Browse the repository at this point in the history
_template is already in self, no need to update it if not in state.
  • Loading branch information
BastienGauthier committed Oct 16, 2023
1 parent c72e335 commit 57a60fe
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions branca/element.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,13 @@ def __getstate__(self):
"""
state: dict = self.__dict__.copy()
state["_env"] = None
state["_template"] = None
state.pop("_template", None)
return state

def __setstate__(self, state: dict):
"""Re-add ._env attribute when unpickling"""
state["_env"] = ENV

state["_template"] = self._template

if state["_template_str"] is not None:
state["_template"] = Template(state["_template_str"])
elif state["_template_name"] is not None:
Expand Down

0 comments on commit 57a60fe

Please sign in to comment.