This repository was archived by the owner on Sep 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 1515class CodeStream (object ):
1616 stream = None
1717 depth_processed = None
18- _len = None
19- _value = None
18+ _length_cache = None
19+ _raw_code_bytes = None
2020
2121 logger = logging .getLogger ('eth.vm.CodeStream' )
2222
2323 def __init__ (self , code_bytes : bytes ) -> None :
2424 validate_is_bytes (code_bytes , title = "CodeStream bytes" )
2525 self .stream = io .BytesIO (code_bytes )
26- self ._value = code_bytes
27- self ._len = len (code_bytes )
26+ self ._raw_code_bytes = code_bytes
27+ self ._length_cache = len (code_bytes )
2828 self .invalid_positions = set () # type: Set[int]
2929 self .depth_processed = 0
3030
3131 def read (self , size : int ) -> bytes :
3232 return self .stream .read (size )
3333
3434 def __len__ (self ) -> int :
35- return self ._len
35+ return self ._length_cache
3636
3737 def __iter__ (self ) -> 'CodeStream' :
3838 return self
@@ -41,7 +41,7 @@ def __next__(self) -> int:
4141 return self .next ()
4242
4343 def __getitem__ (self , i : int ) -> int :
44- return self ._value [i ]
44+ return self ._raw_code_bytes [i ]
4545
4646 def next (self ) -> int :
4747 next_opcode_as_byte = self .read (1 )
You can’t perform that action at this time.
0 commit comments