Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: optimize VyperNode.deepcopy #3784

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion vyper/ast/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import decimal
import functools
import operator
import pickle
import sys
import warnings
from typing import Any, Optional, Union
Expand Down Expand Up @@ -357,6 +358,9 @@ def __hash__(self):
values = [getattr(self, i, None) for i in VyperNode.__slots__ if not i.startswith("_")]
return hash(tuple(values))

def __deepcopy__(self, memo):
return pickle.loads(pickle.dumps(self))

def __eq__(self, other):
if not isinstance(other, type(self)):
return False
Expand Down Expand Up @@ -786,7 +790,6 @@ class ExprNode(VyperNode):

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

self._expr_info = None


Expand Down
Loading