File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -2738,6 +2738,16 @@ def _try_fold(self, node):
27382738
27392739BUILTIN_FUNCTIONS = {** STMT_DISPATCH_TABLE , ** DISPATCH_TABLE }.keys ()
27402740
2741+ # reset the state of the builtins
2742+ # so that attributes like `_warned` don't persist across runs
2743+ def reinstantiate_builtins ():
2744+ for t in [DISPATCH_TABLE , STMT_DISPATCH_TABLE ]:
2745+ for k , v in t .items ():
2746+ new_instance = type (v )()
2747+ t [k ] = new_instance
2748+ global BUILTIN_FUNCTIONS
2749+ BUILTIN_FUNCTIONS = {** DISPATCH_TABLE , ** STMT_DISPATCH_TABLE }.keys ()
2750+
27412751
27422752def get_builtin_functions ():
27432753 return {** STMT_DISPATCH_TABLE , ** DISPATCH_TABLE }
Original file line number Diff line number Diff line change 77import vyper .codegen .core as codegen
88from vyper import ast as vy_ast
99from vyper .ast import natspec
10+ from vyper .builtins import functions as builtins
1011from vyper .codegen import module
1112from vyper .codegen .ir_node import IRnode
1213from vyper .compiler .input_bundle import FileInput , FilesystemInputBundle , InputBundle
@@ -115,6 +116,7 @@ def contract_path(self):
115116
116117 @cached_property
117118 def _generate_ast (self ):
119+ builtins .reinstantiate_builtins ()
118120 is_vyi = self .contract_path .suffix == ".vyi"
119121
120122 settings , ast = vy_ast .parse_to_ast_with_settings (
You can’t perform that action at this time.
0 commit comments