-
Notifications
You must be signed in to change notification settings - Fork 632
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate
SELFDESTRUCT
starting at Shanghai only
- Add a deprecate method wrapper - Use this to wrap the opcode instructions for ``SELFDESTRUCT`` in the ``SHANGHAI_OPCODES`` - Add tests to make sure the deprecation warning is only listed for ``SELFDESTRUCT`` and only within the Shanghai VM
- Loading branch information
Showing
4 changed files
with
93 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import functools | ||
import warnings | ||
from typing import ( | ||
Any, | ||
Callable, | ||
TypeVar, | ||
cast, | ||
) | ||
|
||
|
||
TFunc = TypeVar("TFunc", bound=Callable[..., Any]) | ||
|
||
|
||
def deprecate_method(func: TFunc, message: str = None) -> TFunc: | ||
@functools.wraps(func) | ||
def deprecated_func(*args: Any, **kwargs: Any) -> Any: | ||
warnings.warn( | ||
category=DeprecationWarning, | ||
message=( | ||
message | ||
or f"{func.__name__} is deprecated. " | ||
"A breaking change is expected in a future release." | ||
), | ||
) | ||
func(*args, **kwargs) | ||
|
||
return cast(TFunc, deprecated_func) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters